Hello guys m very new to the php world and m in the learning process... i got the uploading script frm w3schools...but it has got some limits 1.i want unlimited uploading script for my web page where user can upload there stuff with no file size limit...... 2.and also when i upload stuff it directly goes into the folder called UPLOADS [as scripted] but i want the file which i upload should display in new html page where it will be visible for download after uploading....so please give me the scripts i'l be very grateful
I think I see what you want to do now. I'm not sure if this will work, as I can't test it right now, so just try and see. Change the opening of the script to this: <?php if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] > 0)) // Instead of making sure the file is less than 20,000 bytes, it now makes sure it is more than 0, so unlimited size basically { PHP: For your next thing, where you want the script to add a link to a HTML page for downloading, you could add something like this: $file = fopen("downloads.html", "a") or exit ("Can't open downloads.html for editing"); $to_add = "<a href=\"uploads/$name_of_upload_file\">$name_of_upload_file</a><br />"; fwrite($file, $to_add); fclose($file); PHP: That's along the lines of what you need to do. Hope that helps
"""1.well i did this but nothing is getting uploaded above 2mb""""" <?php if ((($_FILES["file"]["type"] == "image/gif") || ($_FILES["file"]["type"] == "image/jpeg") || ($_FILES["file"]["type"] == "image/pjpeg")) && ($_FILES["file"]["size"] > 0)) // Instead of making sure the file is less than 20,000 bytes, it now makes sure it is more than 0, so unlimited size basically { """""2.well i placed your code like this below move_uploaded_file and after uploading some file it created download.html file with no download link so i took the source code to show you here it is......""<a href="uploads/"></a><br />"" { move_uploaded_file($_FILES["file"]["tmp_name"], "upload/" . $_FILES["file"]["name"]); echo "Stored in: " . "upload/" . $_FILES["file"]["name"]; $file = fopen("downloads.php", "a") or exit ("Can't open downloads.php for editing"); $to_add = "<a href=\"uploads/$name_of_upload_file\">$name_of_upload_file</a><br />"; fwrite($file, $to_add); fclose($file); }
you can also change the upload limit with .htaccess check this http://roshanbh.com.np/2008/01/uploading-larger-files-in-php.html Note that if you are on shared hosting there might be memory limit that you can't exceed.
Right, do what itvn has suggested above. That's the main problem. What you're also doing is you're using my variable $name_of_upload_file without actually assigning it to anything. You'll need to add a line: $name_of_upload_file = $_FILES["file"]["name"]; then it'll at least have a chance of working.