Xurion Posted July 12, 2008 Share Posted July 12, 2008 Hi all, I'm writing an import script that takes a CSV file and inserts all the rows into a mysql DB. I'm using a simple form to browse for the CSV and click save and it executed the upload. The problem I'm having is with the upload_max_filesize in the php.ini. The full CSV is about 3mb and it send back an error saying it exceeds the upload_max_filesize amount. It works with lesser file size CSV files. I've set the following in my script: ini_set('upload_max_filesize', '5000000'); But it seems to ignore it. Is this incorrect? I don't want to have to set the actual ini file to 5mb upload_max_filesize as there are multiple users on the server. Thanks in advance Xur~ Link to comment https://forums.phpfreaks.com/topic/114398-problem-with-upload_max_filesize/ Share on other sites More sharing options...
vikramjeet.singla Posted July 12, 2008 Share Posted July 12, 2008 please check safe_mode for on or off if it is on you can not change it with ini_set... Link to comment https://forums.phpfreaks.com/topic/114398-problem-with-upload_max_filesize/#findComment-588284 Share on other sites More sharing options...
Xurion Posted July 12, 2008 Author Share Posted July 12, 2008 php.ini says: safe_mode = Off I've set up a test script that has the following code: ini_set('upload_max'filesize', '5000000'); echo ini_get('upload_max'filesize'); This still returns '2M'. Any clues? Link to comment https://forums.phpfreaks.com/topic/114398-problem-with-upload_max_filesize/#findComment-588286 Share on other sites More sharing options...
vikramjeet.singla Posted July 12, 2008 Share Posted July 12, 2008 try this.... ini_set('upload_max_filesize', '5M'); echo ini_get('upload_max_filesize'); Link to comment https://forums.phpfreaks.com/topic/114398-problem-with-upload_max_filesize/#findComment-588291 Share on other sites More sharing options...
Xurion Posted July 12, 2008 Author Share Posted July 12, 2008 It still echos '2M'. I put the following code in instead: ini_set('upload_max_filesize', '5M') or die('error'); And it echoed 'error'. Something is preventing me from changing this. Is there any way I can get this error to tell me what it is? Nothing is logging to the php error log. Thanks for your help so far EDIT: Ok, this is even stranger. I changed my php.ini for the time being, but it still echos '2M' :-\ Link to comment https://forums.phpfreaks.com/topic/114398-problem-with-upload_max_filesize/#findComment-588293 Share on other sites More sharing options...
vikramjeet.singla Posted July 12, 2008 Share Posted July 12, 2008 can you post your php.ini.................. Link to comment https://forums.phpfreaks.com/topic/114398-problem-with-upload_max_filesize/#findComment-588302 Share on other sites More sharing options...
PFMaBiSmAd Posted July 12, 2008 Share Posted July 12, 2008 The value you are trying to change cannot be set using an ini_set() statement. You must set upload_max_filesize in the master php.ini, in a .htaccess file (when php is running as an Apache module), or in a local php.ini (when php is running as a CGI wrapper.) From the php manual - upload_max_filesize changeable: PHP_INI_PERDIR PHP_INI_PERDIR: Entry can be set in php.ini, .htaccess or httpd.conf Link to comment https://forums.phpfreaks.com/topic/114398-problem-with-upload_max_filesize/#findComment-588346 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.