Hey, when people are on my site, they want to upload files like avatars. Does anybody know the code to make a form where you can fill in the file on your harddisk and when you submit the file is uploaded to my server? thanks greetzzz tAK
<i> </i> <form method="post" encoding="multopart/form-data"> <input type="file size="35" name="filetoupload"/> <input type="submit" name="upload" value="Upload"/> </form>
<i> </i><?php <i> </i>$UploadDir = './'; <i> </i>$UploadFileName = $UploadDir . $_FILES['filetoupload']['name']; <i> </i>print "<pre>"; <i> </i>if (move_uploaded_file($_FILES['filetoupload']['tmp_name'], $UploadFileName)) { <i> </i> print "File successfully uploaded. "; <i> </i> print "Debug information:n"; <i> </i> print_r($_FILES); <i> </i>} else { <i> </i> print "File exceed the limited size!n"; <i> </i> print_r($_FILES); <i> </i>} <i> </i>print "</pre>"; ?>
<i> </i><form method="post" enctype="multipart/form-data" action="upload.php"> <input type="file" size="35" name="filetoupload"/> <input type="submit" name="upload" value="Upload"/> </form>
<i> </i><input type="hidden" name="MAX_FILE_SIZE" value="50000" />
Help @The_Anime_King spread the word by sharing this article on Twitter...