HTML form file upload problems (again)

HTML form file upload problems (again)

Posted by: pucepoi
Posted on: 2007-01-30 20:51:00

I'm trying to allow users to upload files via an HTML form to a php script. At the advice of this forum, I followed the instructions from the PHP.ini entry in the wiki to the letter, hopefully increasing the maximum upload size from 7MB to 20.

Unfortunately, it still doesn't seem to work -- the file upload fails at some point and the script returns an error. I don't know if this is because the php.ini fix isn't taking or there's a timeout or what. I know it's not a script bug because it works fine with small files. How should I proceed?

Re: HTML form file upload problems (again)

Posted by: ardco
Posted on: 2007-01-30 20:58:00

In reply to:

the file upload fails at some point


How big are the files?

Re: HTML form file upload problems (again)

Posted by: pucepoi
Posted on: 2007-01-30 21:08:00

More than 7MB. I've tried several, it failed with a file that's ~6.9 MB, hence the confusion about cause.

Re: HTML form file upload problems (again)

Posted by: ardco
Posted on: 2007-01-30 21:13:00

Just checking for >20. laugh

Re: HTML form file upload problems (again)

Posted by: Raz2133
Posted on: 2007-01-30 21:32:00

In reply to:

I don't know if this is because the php.ini fix isn't taking


To see if your php.ini setting is 'taking' or not, create a file containing the line below, browse to this file and you will be able to check if your custom settings are being used.

<?php phpinfo(); ?>

Mark

Re: HTML form file upload problems (again)

Posted by: pucepoi
Posted on: 2007-01-30 22:26:00

Mark,

Thanks. The info page showed that the ini file being used was the correct (custom) one. I assume that means I'm hitting some kind of timeout? Can that be changed? Or does it take some time (e.g. a few days) before the ini file settings take effect?

Re: HTML form file upload problems (again)

Posted by: Raz2133
Posted on: 2007-01-30 22:35:00

In reply to:

The info page showed that the ini file being used was the correct (custom) one.


That's a good start smile

If you scroll down a little on the phpinfo page, you should see the current setting for upload_max_filesize, it is probably best to confirm that it is showing what you expect it to show ( 20M ).

In reply to:

I assume that means I'm hitting some kind of timeout? Can that be changed?


The default value for max_execution_time is 30 seconds by default, you might try increasing this to see if it solves your problem.

In reply to:

does it take some time (e.g. a few days) before the ini file settings take effect?


No, there is no delay, the new settings should take effect as soon as you modify the php.ini file.

Mark

Re: HTML form file upload problems (again)

Posted by: pucepoi
Posted on: 2007-01-31 20:38:00

OK. The phpinfo shows that the upload_max_filesize and post_max_size are both 20M, and I modified the max_execution_time and max_input_time to 600 seconds.

Still no luck. :(

EDIT: Naturally, the solution appears as soon as I post. Apaprently my script was using a deprecated file variable ($_HTTP_INPUT_FILES or something similar) which the php.ini trick broke for some reason. Well, at least it works now!

Thanks for the help all the same. :)

Edited by pucepoi on 01/31/07 08:58 PM (server time).

Re: HTML form file upload problems (again)

Posted by: Raz2133
Posted on: 2007-01-31 21:29:00

In reply to:

Well, at least it works now!


Excellent, I am glad you got it sorted.

In reply to:

which the php.ini trick broke for some reason.


Hmmm... perhaps you were using PHP4 before and your custom install is PHP5?

In reply to:

Thanks for the help all the same. :)


No problem, I am always glad to help where I can. smile

Mark

Tags: file uploadupload filesscript returnsi don t knowphp scripttimeoutwiki