jonoc33 Posted March 10, 2009 Share Posted March 10, 2009 I've made an upload form/script for one of my websites yet whenever I upload, $_FILES contains no data in it at all (i've done print_r($_FILES)). I've also done ini_set("upload_file_maxsize", "10M"); AND ini_set("post_file_maxsize", "10M"); to make sure that the max size of uploads doesn't mess it up. I know it's something to do with the size because if I upload a significantly smaller file it works. Any ideas? Link to comment https://forums.phpfreaks.com/topic/148729-upload-problems-_files-has-no-data/ Share on other sites More sharing options...
ratcateme Posted March 10, 2009 Share Posted March 10, 2009 i am fairly sure you can't use ini_set on upload_file_maxsize or post_file_maxsize as ini_set takes effect when the command is called and so it takes the values from the ini file at the start checks them then decides if it will add it to $_FILES. you will need to change these values in you php.ini file Scott. Link to comment https://forums.phpfreaks.com/topic/148729-upload-problems-_files-has-no-data/#findComment-780952 Share on other sites More sharing options...
jonoc33 Posted March 10, 2009 Author Share Posted March 10, 2009 So there is no way of fixing the problem unless I have access to php.ini? I'm paying for a web hoster, so that won't be happening any time soon. Link to comment https://forums.phpfreaks.com/topic/148729-upload-problems-_files-has-no-data/#findComment-780953 Share on other sites More sharing options...
ratcateme Posted March 10, 2009 Share Posted March 10, 2009 don't know if you hosting will support this but is possible to set ini directives from .htaccess i have never used it so i don't know how they effect file uploads or if they would be able to solve your problem i haven't used them before but you should find a tutorial with a quick google Scott. Link to comment https://forums.phpfreaks.com/topic/148729-upload-problems-_files-has-no-data/#findComment-780954 Share on other sites More sharing options...
PFMaBiSmAd Posted March 10, 2009 Share Posted March 10, 2009 The $_FILES array will be empty if your form is invalid, if uploads are not enabled on your server, or if you exceed the post_max_size setting. What is the code for your form, use a phpinfo(); statement to check if uploads are enabled and to find the post_max_size setting and what is the size of the upload file you are testing with? And you cannot set the upload size settings (which are upload_max_filesize and post_max_size, I'm not sure where you got the two you were trying) using ini_set() statements as stated by ratcateme and also found in the php documentation. Link to comment https://forums.phpfreaks.com/topic/148729-upload-problems-_files-has-no-data/#findComment-780955 Share on other sites More sharing options...
phpdragon Posted March 10, 2009 Share Posted March 10, 2009 make sure your form has this in the <form> tag or you will have no file upload turned on enctype="multipart/form-data" edit: just noticed the bit about it working with smaller files ignore this then you must have this already set Link to comment https://forums.phpfreaks.com/topic/148729-upload-problems-_files-has-no-data/#findComment-780971 Share on other sites More sharing options...
aschk Posted March 10, 2009 Share Posted March 10, 2009 Most webhosts these days CAN provide custom php environmental variables for your apache config file. You need to request that they change this (within reason of course). The fact that you can upload smaller file indicates that it's a size issue. Link to comment https://forums.phpfreaks.com/topic/148729-upload-problems-_files-has-no-data/#findComment-781008 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.