SitePoint Sponsor |
|
User Tag List
Results 1 to 7 of 7
-
Jun 14, 2005, 12:03 #1
- Join Date
- Aug 2003
- Location
- Minnesota
- Posts
- 1,861
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
$_FILES['file']['size'] = "0" on one server but works fine on others?
I'm experiencing a strange problem. I have set up an upload script where the user selects a file to upload and will check the size and compare it to the limit before uploading. For some reason, on my server it will work properly but on my client's server it returns 0 every time. I'm assuming it may be something to do with the server settings?
I won't post the code right off the bat because it works on one server (same exact code) but not the other. PHP version on the server that DOESN'T work is 4.2.2 with safe mode off.
Is there a server/PHP setting that I should know about that could cause this problem? It shouldn't have anything to do with the upload size as I have checked those settings, especially since the file is only 40k and the limit is 2M.
Anyone have any ideas? Thanks.Kevin Hauge : Modern Leaf Design : Follow Us on Facebook
Client Axis v.08 - client / project management script
-
Jun 14, 2005, 12:25 #2
- Join Date
- Jun 2002
- Location
- Montana, USA
- Posts
- 647
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
It might have to do with your setting in php.ini for register_globals.
The server that works may have register_globals turned on (allowing the superglobal variables $_FILE, $_REQUEST, $_COOKIE, etc), whereas the other server may have the setting turned off.
It seems like it would be turned on for both servers though, as I believe that's the default setting after php 4.1.0.
Check out the settings to see if there is a discrepancy between the values of register_globals in the two config files -- this is just a guess, could be way off.Ryan
-
Jun 14, 2005, 13:15 #3
- Join Date
- Aug 2003
- Location
- Minnesota
- Posts
- 1,861
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
Thanks for the suggestion. I checked the settings and did some tests. Before I started I had uploaded an htaccess file making sure register_globals was set on if it wasn't along with upping the upload_max_filesize.
The local value for register_globals is set to On (because of the htaccess) while the Master is set to Off. I don't think this would be the issue as it passes the correct file name using $_FILES['file']['name']. It's just the size that is the issue.
Using the Files tag of $_FILES['file']['error'] I discovered that it is giving me an error of 1, which means the upload is exceeding the max size set in php.ini ...
That would be great but it actually doesn't. The file size is 40k but upload_max_filesize = 25M, post_max_size = 8M, max_execution_time = 60, file_uploads = 1. Thus I don't understand how it can be exceeding the setting ... which is why I thought maybe there was another setting I'm missing? Seems strange.Kevin Hauge : Modern Leaf Design : Follow Us on Facebook
Client Axis v.08 - client / project management script
-
Jun 14, 2005, 15:34 #4
Maybe reboot the webserver that it isn't working on.
-
Jun 15, 2005, 06:23 #5
- Join Date
- Aug 2003
- Location
- Minnesota
- Posts
- 1,861
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
I'm not sure where the site is hosted at this moment but I'll research it and see if I can contact them about restarting. Not sure if that will resolve it, but we'll try it.
Kevin Hauge : Modern Leaf Design : Follow Us on Facebook
Client Axis v.08 - client / project management script
-
Jun 15, 2005, 06:45 #6
- Join Date
- May 2005
- Posts
- 53
- Mentioned
- 0 Post(s)
- Tagged
- 0 Thread(s)
The file uploading depends of several parameters:
file_uploads, upload_max_filesize, upload_tmp_dir, post_max_size and max_input_time directives in php.ini
-
Jun 15, 2005, 11:23 #7
- Join Date
- Aug 2003
- Location
- Minnesota
- Posts
- 1,861
- Mentioned
- 1 Post(s)
- Tagged
- 0 Thread(s)
Originally Posted by patter
Originally Posted by LiquidReflex
Just very confusing ...Kevin Hauge : Modern Leaf Design : Follow Us on Facebook
Client Axis v.08 - client / project management script
Bookmarks