Jump to content

Problem with 'upload_max_filesize'


Xurion

Recommended Posts

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

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'  :-\

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.