jonstroh Posted May 12, 2011 Share Posted May 12, 2011 I have used a tutorial to create an upload form for my website, it works fine until the file gets over 850 kb, how can I set it up so larg files 80 megs and up can be uploaded? Here is the simple code I am using,form <form enctype="multipart/form-data" action="uploader.php" method="POST"> <input type="hidden" name="MAX_FILE_SIZE" value="100000000" /> Choose a file to upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </form> PHP <html> Thanks <head> <title>My First PHP Page</title> </head> <body> <?php $target_path = "uploads/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } ?> </body> </html> Quote Link to comment https://forums.phpfreaks.com/topic/236255-newbie-php/ Share on other sites More sharing options...
cssfreakie Posted May 12, 2011 Share Posted May 12, 2011 in php.ini there are a settings you need to change (filesize that is). ;;;;;;;;;;;;;;;; ; File Uploads ; ;;;;;;;;;;;;;;;; ; Whether to allow HTTP file uploads. ; http://php.net/file-uploads file_uploads = On ; Temporary directory for HTTP uploaded files (will use system default if not ; specified). ; http://php.net/upload-tmp-dir upload_tmp_dir = "c:/wamp/tmp" ; Maximum allowed size for uploaded files. ; http://php.net/upload-max-filesize upload_max_filesize = 2M Although I am not sure if you can get to the php.ini or that your on a shared host. Nor do i know if uploading files of 800M is very stable. But what you could try if you can't edit php.ini is the following Put this above your script: ini_set('upload_max_filesize', '800M'); Not sure if it works, but it's worth a try Quote Link to comment https://forums.phpfreaks.com/topic/236255-newbie-php/#findComment-1214665 Share on other sites More sharing options...
jonstroh Posted May 12, 2011 Author Share Posted May 12, 2011 Thank You for your help I did edit the php.ini file on my server, and set it to 800M, that allowed me to upload a 6 meg file successfully, so then I zipped up the database file(mdf) and it then was only 26 megs, but it failed. So I tried a 14 meg file and it failed also. Both were zip files does that matter? Are there any other settings I can change? Here is the code I am using now FormHTML <form enctype="multipart/form-data" action="uploader.php" method="POST"> <input type="hidden" /> Choose a file to upload: <input name="uploadedfile" type="file" /><br /> <input type="submit" value="Upload File" /> </form> PHP Code <?php $target_path = "uploads/"; $target_path = $target_path . basename( $_FILES['uploadedfile']['name']); if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) { echo "The file ". basename( $_FILES['uploadedfile']['name']). " has been uploaded"; } else{ echo "There was an error uploading the file, please try again!"; } ?> Quote Link to comment https://forums.phpfreaks.com/topic/236255-newbie-php/#findComment-1214692 Share on other sites More sharing options...
jonstroh Posted May 12, 2011 Author Share Posted May 12, 2011 When I tried to upload the mdf file without being zipped I get this error 404 - File or directory not found. The resource you are looking for might have been removed, had its name changed, or is temporarily unavailable. Jon Quote Link to comment https://forums.phpfreaks.com/topic/236255-newbie-php/#findComment-1214695 Share on other sites More sharing options...
jonstroh Posted May 15, 2011 Author Share Posted May 15, 2011 Well I found an article of sorts about this and made changes to file_uploads upload_max_filesize max_input_time memory_limit max_execution_time post_max_size And now my uploads are working on 26M files hope this helps someone else. Heres the link: http://www.radinks.com/upload/config.php Quote Link to comment https://forums.phpfreaks.com/topic/236255-newbie-php/#findComment-1215574 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.