PHP Tutorial : How to make a file uploader
Dec 12, 2008 Useful PHP
Hi,
In this php tutorial you will learn how to make a file uploader. Less words, and here we are : first we create the html form
<form action="" method="POST" enctype="multipart/form-data"> Browse file to upload <input type="file" name="filetoupload" id="filetoupload"><br/> <input type="submit" name="sb" id="sb" value="Upload now"> </form>
Now that we have the html form created, I’ve pushed the action on itself. So, no need to create another separate page to process the data.
Here is the php code
<?php if(isset($_POST['sb'])) { $path = "yourpath"; $file = $_FILES['filetoupload']['name']; move_uploaded_file($_FILES['filetoupload']['tmp_name'], "$path/$file"); } ?>
Bulk php file uploader is now done,
Enjoy!


October 21st, 2009 at 12:12 pm
lol you kidding? that way i could upload a php file, that’s not smart
October 23rd, 2009 at 5:36 pm
Sigh, you’r right. As mentioned elsewhere I, err, “inherited” this blog. And really need to spend a weekend reading the posts that don’t belong to me and clean them up.
Thanks for bringing this one to my attention.
November 15th, 2009 at 10:10 pm
it says it’s a “file uploader” so yes you can upload .php files too because its a file, so what would be the issue?
December 14th, 2009 at 11:28 pm
can you upload mp3 vid with this script.