bluebyyou Posted December 14, 2007 Share Posted December 14, 2007 I have a script to upload multiple jpeg files. It seems to work fine except for large files, when it fails. If I only upload one large file I am able to check the file size and see if it is too big, but once I start the multiple files the scrip just brakes. The $_FILES array doesn't seem to be getting set or something. Quote Link to comment https://forums.phpfreaks.com/topic/81615-solved-multiple-file-upload-and-file-sizes/ Share on other sites More sharing options...
cooldude832 Posted December 14, 2007 Share Posted December 14, 2007 do print_r($_FILES); on the process page and see what happens you might be over reaching your post limit or file send limit Quote Link to comment https://forums.phpfreaks.com/topic/81615-solved-multiple-file-upload-and-file-sizes/#findComment-414607 Share on other sites More sharing options...
bluebyyou Posted December 14, 2007 Author Share Posted December 14, 2007 I tried print_r($_FILES); If I upload one large file I get: Array ( [upload] => Array ( [name] => Array ( [0] => DSC00269.JPG ) [type] => Array ( [0] => image/jpeg ) [tmp_name] => Array ( [0] => /tmp/php6pc0Qs ) [error] => Array ( [0] => 0 ) [size] => Array ( [0] => 2759482 ) ) ) If I upload 5 Large files I get: Array ( ) If I upload 5 smaller files I get: Array ( [upload] => Array ( [name] => Array ( [0] => test50.jpg [1] => test50.jpg [2] => test50.jpg [3] => test50.jpg [4] => test50.jpg ) [type] => Array ( [0] => image/jpeg [1] => image/jpeg [2] => image/jpeg [3] => image/jpeg [4] => image/jpeg ) [tmp_name] => Array ( [0] => /tmp/phpFo3PLZ [1] => /tmp/phpz7J9PK [2] => /tmp/phpgVe9SK [3] => /tmp/phph3r6lY [4] => /tmp/php7V1Onq ) [error] => Array ( [0] => 0 [1] => 0 [2] => 0 [3] => 0 [4] => 0 ) [size] => Array ( [0] => 303108 [1] => 303108 [2] => 303108 [3] => 303108 [4] => 303108 ) ) ) Quote Link to comment https://forums.phpfreaks.com/topic/81615-solved-multiple-file-upload-and-file-sizes/#findComment-414622 Share on other sites More sharing options...
cooldude832 Posted December 14, 2007 Share Posted December 14, 2007 check your phpinfo and get what your max_post_file_size is tehn check if you are exceeding it Quote Link to comment https://forums.phpfreaks.com/topic/81615-solved-multiple-file-upload-and-file-sizes/#findComment-414632 Share on other sites More sharing options...
bluebyyou Posted December 14, 2007 Author Share Posted December 14, 2007 8m is the max. So do I add up all the files im attempting to know if im over the limit? Or is by the individual file? Quote Link to comment https://forums.phpfreaks.com/topic/81615-solved-multiple-file-upload-and-file-sizes/#findComment-414633 Share on other sites More sharing options...
cooldude832 Posted December 14, 2007 Share Posted December 14, 2007 are u exceeding it? also do a print_r($GLOBALS); lets see what is happening Quote Link to comment https://forums.phpfreaks.com/topic/81615-solved-multiple-file-upload-and-file-sizes/#findComment-414634 Share on other sites More sharing options...
bluebyyou Posted December 14, 2007 Author Share Posted December 14, 2007 5 of the large files i tried total to over 11mb. here is the print_r($GLOBALS); / I thought there was a way to print it out more organized like with var_dump, but that was a mess too. Quote Link to comment https://forums.phpfreaks.com/topic/81615-solved-multiple-file-upload-and-file-sizes/#findComment-414644 Share on other sites More sharing options...
cooldude832 Posted December 14, 2007 Share Posted December 14, 2007 its tabbed and break line delimetered view its source code and its very clear, well if you have 11mb and your max upload is 8 you have a problem, increase max upload Quote Link to comment https://forums.phpfreaks.com/topic/81615-solved-multiple-file-upload-and-file-sizes/#findComment-414646 Share on other sites More sharing options...
bluebyyou Posted December 14, 2007 Author Share Posted December 14, 2007 If anything I want to decrease the max upload size for the sake of speed. How do I check the file size before it is uploaded? Or prevent a file over 500KB to be uploaded? Quote Link to comment https://forums.phpfreaks.com/topic/81615-solved-multiple-file-upload-and-file-sizes/#findComment-414650 Share on other sites More sharing options...
bluebyyou Posted December 15, 2007 Author Share Posted December 15, 2007 Bump Quote Link to comment https://forums.phpfreaks.com/topic/81615-solved-multiple-file-upload-and-file-sizes/#findComment-415507 Share on other sites More sharing options...
bluebyyou Posted January 10, 2008 Author Share Posted January 10, 2008 So I talked to my hosting company and they told me that I can upload a new php.ini file into my root directory, so I can change the file upload size settings. The technical support person couldn't tell me if I could just put the settings I want to change in this file, or if I need to have a complete php.ini file to do this. So thats my question, can I just put the specific settings or do i need an entire php.ini file. And also where can i find a template for the file? I did find one, but this is my first try at messing with the php.ini, so im not sure if its the right thing. Quote Link to comment https://forums.phpfreaks.com/topic/81615-solved-multiple-file-upload-and-file-sizes/#findComment-435208 Share on other sites More sharing options...
PFMaBiSmAd Posted January 10, 2008 Share Posted January 10, 2008 A local php.ini (in your web root folder) normally on requires you to list the settings you want to change. If a setting is in the file, it overrides the mast setting. Quote Link to comment https://forums.phpfreaks.com/topic/81615-solved-multiple-file-upload-and-file-sizes/#findComment-435218 Share on other sites More sharing options...
bluebyyou Posted January 10, 2008 Author Share Posted January 10, 2008 So i only need to list the ones i want to change or all of them? Quote Link to comment https://forums.phpfreaks.com/topic/81615-solved-multiple-file-upload-and-file-sizes/#findComment-435226 Share on other sites More sharing options...
cooldude832 Posted January 10, 2008 Share Posted January 10, 2008 yeah you do a similar thing with .htacess and then your server will pick up on them and add them to the master list because they are like declaring variables even if one above it was set like PHP DISPLAY_ERRORS OFF and then later down you wirte PHP DISPLAY ERRORS ON the later will rewrite the upper Quote Link to comment https://forums.phpfreaks.com/topic/81615-solved-multiple-file-upload-and-file-sizes/#findComment-435271 Share on other sites More sharing options...
bluebyyou Posted January 10, 2008 Author Share Posted January 10, 2008 Ok, so how do I format it? this is what i want, it seems too simple to put this in the file.. memory_limit = 60M post_max_size = 20M upload_max_filesize = 20M Quote Link to comment https://forums.phpfreaks.com/topic/81615-solved-multiple-file-upload-and-file-sizes/#findComment-435688 Share on other sites More sharing options...
cooldude832 Posted January 10, 2008 Share Posted January 10, 2008 save this as php.ini upload_max_filesize = 60M; and put it in that scripts folder Quote Link to comment https://forums.phpfreaks.com/topic/81615-solved-multiple-file-upload-and-file-sizes/#findComment-435691 Share on other sites More sharing options...
bluebyyou Posted January 10, 2008 Author Share Posted January 10, 2008 Thank you. Quote Link to comment https://forums.phpfreaks.com/topic/81615-solved-multiple-file-upload-and-file-sizes/#findComment-435703 Share on other sites More sharing options...
PFMaBiSmAd Posted January 10, 2008 Share Posted January 10, 2008 A great way of learning and finding out if something works or not is to try it yourself, especially when it involves computers and programming. Why ask something in a forum and wait around for hours or days for a reply when you can try it yourself and get almost immediate results. What could be hurt by trying settings in a file. Either the file and the settings work or they don't. As long as you are not doing something that could delete data or files, there is little risk and if we assume that you are following good data and file backup practices, even code that could delete data or files is safe to try. Quote Link to comment https://forums.phpfreaks.com/topic/81615-solved-multiple-file-upload-and-file-sizes/#findComment-435709 Share on other sites More sharing options...
bluebyyou Posted January 10, 2008 Author Share Posted January 10, 2008 PFMaBiSmAd, Im sorry you feel like I am wasting peoples time or something, however I did try it, and did see changes when i looked at the phpinfo(). I like to make sure i am doing things correctly, and know why I am doing them. Just because something seems to work doesn't mean it is the right way, or that it will always work. Your comment was unnecessary as the topic has already been solved. Do you contribute anything constructive, or just make people afraid to ask questions? (rhetorical question by the way, think about it) Quote Link to comment https://forums.phpfreaks.com/topic/81615-solved-multiple-file-upload-and-file-sizes/#findComment-435819 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.