Upload problem – PHP

  php

Q(Question):

I have a file upload set up from a form, which works fine with small
files (6k) but fails silently with larger ones (16k and up).

The form has:

<input type="hidden" name="MAX_FILE_SIZE" value="1000000">

and the script handling the uploads has:

set_time_limit(3000); // no difference with set_time_limit(0)
ignore_user_abort(true);

which should provide ample time for whatever needs to happen. The sever is
not running under safe mode.

When the upload fails, nothing happens in the browser: after the files
appear to have been sent (as measured by the time it takes for activity to
stop on my line monitor), the original form is still there, and I see no
error message.

What could be the cause of such behavior?

Pierre

Pierre Jelenc | H o m e O f f i c e R e c o r d s
| * Marwood * The Cucumbers *
T h e G i g o m e t e r | * Switchblade Kittens * Pawnshop *
www.thegigometer.com | www.homeofficerecords.com

A(Answer):

Pierre Jelenc wrote:

When the upload fails, nothing happens in the browser: after the files
appear to have been sent (as measured by the time it takes for activity to
stop on my line monitor), the original form is still there, and I see no
error message.

What could be the cause of such behavior?

No idea

put

<?php
echo ‘<pre>POST’; print_r($_POST);
echo ‘<br />FILES’; print_r($_FILES);
echo ‘</pre>’;
?>

in the part of your script that handles the uploads to
test/verify/debug the posting process.

"Yes, I’m positive."
"Are you sure?"
"Help, somebody has stolen one of my electrons!"
Two atoms are talking:

A(Answer):

Pedro <he****@hotpop.com> writes:

<?php
echo ‘<pre>POST’; print_r($_POST);
echo ‘<br />FILES’; print_r($_FILES);
echo ‘</pre>’;
?>

in the part of your script that handles the uploads to
test/verify/debug the posting process.

When the upload works, the results are as expected, for example:

POST
Array
(
[MAX_FILE_SIZE] => 1000000
[title] => test upload
[submit] => Save
)

FILES
Array
(
[slide] => Array
(
[name] => emmaandtata.jpg
[type] => image/jpeg
[tmp_name] => /tmp/phpSy5sPq
[error] => 0
[size] => 6616
)

)
With a larger file, as I said before, I get nothing, the script is not
executed at all.

Pierre

Pierre Jelenc | H o m e O f f i c e R e c o r d s
| * Marwood * The Cucumbers *
T h e G i g o m e t e r | * Switchblade Kittens * Pawnshop *
www.thegigometer.com | www.homeofficerecords.com

A(Answer):

Pierre Jelenc wrote:
[…]

With a larger file, as I said before, I get nothing, the script is not
executed at all.

What values do you have in PHP.INI for

post_max_size
upload_max_filesize


"Yes, I’m positive."
"Are you sure?"
"Help, somebody has stolen one of my electrons!"
Two atoms are talking:

A(Answer):

Pedro <he****@hotpop.com> writes:

What values do you have in PHP.INI for

post_max_size

8M
upload_max_filesize

7M

Pierre

Pierre Jelenc | H o m e O f f i c e R e c o r d s
| * Marwood * The Cucumbers *
T h e G i g o m e t e r | * Switchblade Kittens * Pawnshop *
www.thegigometer.com | www.homeofficerecords.com

A(Answer):

Pierre Jelenc wrote:

Pedro <he****@hotpop.com> writes:

What values do you have in PHP.INI for

post_max_size

8M

upload_max_filesize

7M

Pierre

fishing …

can you upload large files (16k 🙂 to other servers?
does the server log have anything about the failed upload?


"Yes, I’m positive."
"Are you sure?"
"Help, somebody has stolen one of my electrons!"
Two atoms are talking:

A(Answer):

Pedro <he****@hotpop.com> writes:

can you upload large files (16k 🙂 to other servers?

Yes, to 2 others.
does the server log have anything about the failed upload?

Nothing. The POST request is in the access log, but without any indication
of a problem, and the error log has nothing.

Pierre

Pierre Jelenc | H o m e O f f i c e R e c o r d s
| * Marwood * The Cucumbers *
T h e G i g o m e t e r | * Switchblade Kittens * Pawnshop *
www.thegigometer.com | www.homeofficerecords.com

LEAVE A COMMENT