Custom Search

Wednesday, May 28, 2008

Create simple upload file in PHP

This simple code for upload in php. this need two files, form.html and upload.php.

Form.html

< !DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
< xmlns="http://www.w3.org/1999/xhtml">
<>
< equiv="Content-Type" content="text/html; charset=utf-8">
<>Untitled Document< /title>
< /head>
<>
< action="upload.php" method="post" enctype="multipart/form-data">
Browse File : < type="file" name="filename">
<><>
< type="submit" value="Submit">
< /form>
< /body>
< /html>

and this code for upload.php for handling upload process to server.

< ? $directory="E:/myweb/public_html/example_blog/upload/data";
if(@copy($_FILES[filename][tmp_name],$directory."/".$_FILES[filename][name])):
print "upload success";
else:
print "upload failed";
endif;
exit;
? >






No comments:

Free Traffic

 Join My Community at MyBloglog! Blog Flux Directory 

Web Developement Blogs - BlogCatalog Blog Directory web development blog  Internet Blogs - Blog Top Sites 

Blog Directory 

Click Here for Free Traffic!

Link2Communion.com