Trouble with file uploading

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sonirajesh
Forum Newbie
Posts: 6
Joined: Wed Jul 04, 2007 5:32 am

Trouble with file uploading

Post by sonirajesh »

i am having trouble with uploading, when i upload big size file like >2M
it hang the browser and show blank screen and file does not get upload.

upload_max_filesize is set 8M

also added set_time_limit(0); in my script

But same thing on local network works file, seems problem in more setting.

please help

Rajesh Soni
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

what does

Code: Select all

<?php
echo 'version: ', phpversion(), "<br />\n";
echo 'sapi: ', php_sapi_name(), "<br />\n";
foreach( array(
    'max_execution_time', 'max_input_time',
    'memory_limit', 'post_max_size',
    'upload_tmp_dir', 'upload_max_filesize')
    as $p ) {
  echo $p, ': ', get_cfg_var($p), "<br />\n";
}
print?
sonirajesh
Forum Newbie
Posts: 6
Joined: Wed Jul 04, 2007 5:32 am

Post by sonirajesh »

version: 5.1.4
sapi: apache2handler
max_execution_time: 30
max_input_time:
memory_limit: 32M
post_max_size: 8M
upload_tmp_dir:
upload_max_filesize: 2M
post_max_size: 8M
upload_max_filesize: 2M are handled by htaccess
and they are 16M and 8M respectively
Rajesh Soni
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

sonirajesh wrote:
post_max_size: 8M
upload_max_filesize: 2M are handled by htaccess
and they are 16M and 8M respectively
I'm not sure what this means but...
get_cfg_var() says 2M and you have trouble uploading files >2M. I think all points to upload_max_filesize beeing 2M ;)
upload_max_filesize can be changed via htaccess but it doesn't look like this has happened.
Did you put my code snippet in your actual upload script? That would eliminate all doubts.
User avatar
onion2k
Jedi Mod
Posts: 5263
Joined: Tue Dec 21, 2004 5:03 pm
Location: usrlab.com

Post by onion2k »

Just for the record ... get_cfg_var() reports the php.ini value regardless of whether it's been overridden by htaccess. ini_get() reports the runtime value. Which is backwards in my opinion, but that's PHP for ya'.
User avatar
volka
DevNet Evangelist
Posts: 8391
Joined: Tue May 07, 2002 9:48 am
Location: Berlin, ger

Post by volka »

oops, my mistake.
should be

Code: Select all

echo $p, ': ', ini_get($p), "<br />\n";
then.
Post Reply