Page 1 of 2
CANNOT UPLOAD FILES
Posted: Mon Oct 01, 2007 4:12 pm
by sxgomezf
I've had this PHP app running on my server (windows server 2003 for small business, PHP Version 5.1.2) for more that 1 year but one of the options just stopped working last week. I was able to upload files with no problem but not now. I have not changed configuration files lately but it just won't work.
I already checked php.ini and it seems to be ok (post_max_size = 1024M, upload_max_filesize = 1024M, file_uploads = On), file permissions are ok too. Im getting error_code 7 when I print the array $_FILES (UPLOAD_ERR_CANT_WRITE).
I've been reading and searching for this error for 1 week with no luck.
Any ideas?
Thanks
Posted: Mon Oct 01, 2007 4:52 pm
by jeffery
have you define a upload_tmp_dir in your ini file? Is it writeable by the IUSR_COMPUTERNAME user?
Posted: Mon Oct 01, 2007 5:15 pm
by VladSun
Disk out of space?
Posted: Tue Oct 02, 2007 10:18 am
by sxgomezf
Yes, I defined a new folder to upload the files. Permissions are ok and the partition where the folder is located has 80GB of free space. Im running out of ideas....

Posted: Tue Oct 02, 2007 5:52 pm
by sxgomezf
I tried with small files and they are being uploaded properly, but no files larger than 200Kb
Posted: Wed Oct 03, 2007 3:13 am
by aceconcepts
MAXFILESIZE?
Posted: Wed Oct 03, 2007 8:17 am
by jeffery
have you by chance declared an input field with a MAX_FILE_SIZE in it ?
Code: Select all
<input type="hidden" name="MAX_FILE_SIZE" value="30000" />
Posted: Wed Oct 03, 2007 8:50 am
by VladSun
sxgomezf wrote:Yes, I defined a new folder to upload the files. Permissions are ok and the partition where the folder is located has 80GB of free space. Im running out of ideas....

When you upload file it is first uploaded to temp directory (e.g. /tmp) and after that you have to move it to your destination directory. I wonder whether your temp directory (i.e. disk/partition containing it) has run out of space...
Try echoing $_FILES['file_input_name']['tmp_name'] and see where temporary files are put.
Posted: Wed Oct 03, 2007 4:31 pm
by sxgomezf
The hidden field was declared and MAX_FILE_SIZE set to 1024000.
When echoing $_FILES this is what I get:
Array ( [file] => Array ( [name] => Test.xls [type] => [tmp_name] => [error] => 7 [size] => 0 ) )
Nothing!
The first thing I checked when I got the line above was the temp folder. Both, the temporary and the destination folder have enough space. Permissions are also ok.

Posted: Wed Oct 03, 2007 5:12 pm
by feyd
I don't think permissions are okay. Run this in a new file:
Code: Select all
<?php
$s = ini_get('session.save_path');
if(!file_exists($s))
{
echo var_export($s,true), ' doesn\'t exist!';
exit;
}
$p = (is_dir($s) ? 'd' : '-');
$p .= (is_readable($s) ? 'r' : '-');
$p .= (is_writable($s) ? 'w' : '-');
$p .= (is_executable($s) ? 'x' : '-');
echo var_export($s, true), ' is ', $p;
Posted: Thu Oct 04, 2007 1:24 pm
by sxgomezf
Thanks feyd. I ran the code I this is what i got.
'' doesn't exist!
What does it mean?
Posted: Fri Oct 05, 2007 5:19 am
by jeffery
sxgomezf wrote:Thanks feyd. I ran the code I this is what i got.
'' doesn't exist!
What does it mean?
Your seesions are not getting saved anywhere as either the session.save_path is not defined or the path you have defined doesn't not exits or not writeable
Posted: Fri Oct 05, 2007 8:31 am
by sxgomezf
How could it happen if I have not changed anything and I was uploading files 2 weeks ago? How can I fix it?
Thanks.
Posted: Fri Oct 05, 2007 8:37 am
by sxgomezf
I checked the file php.ini and this line is commented. Is it the way is supposed to be?
;session.save_path = "/tmp"
Posted: Fri Oct 05, 2007 10:55 am
by feyd
I have no idea why I used session.save_path.. it should be upload_tmp_dir .. if it's NULL, PHP uses the system's default temporary directory.