CANNOT UPLOAD FILES

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

sxgomezf
Forum Newbie
Posts: 9
Joined: Mon Oct 01, 2007 3:48 pm

CANNOT UPLOAD FILES

Post 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
jeffery
Forum Contributor
Posts: 105
Joined: Mon Apr 03, 2006 3:13 am
Location: Melbourne, Australia
Contact:

Post by jeffery »

have you define a upload_tmp_dir in your ini file? Is it writeable by the IUSR_COMPUTERNAME user?
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Post by VladSun »

Disk out of space?
There are 10 types of people in this world, those who understand binary and those who don't
sxgomezf
Forum Newbie
Posts: 9
Joined: Mon Oct 01, 2007 3:48 pm

Post 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.... :cry:
sxgomezf
Forum Newbie
Posts: 9
Joined: Mon Oct 01, 2007 3:48 pm

Post by sxgomezf »

I tried with small files and they are being uploaded properly, but no files larger than 200Kb
User avatar
aceconcepts
DevNet Resident
Posts: 1424
Joined: Mon Feb 06, 2006 11:26 am
Location: London

Post by aceconcepts »

MAXFILESIZE?
jeffery
Forum Contributor
Posts: 105
Joined: Mon Apr 03, 2006 3:13 am
Location: Melbourne, Australia
Contact:

Post 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" />
User avatar
VladSun
DevNet Master
Posts: 4313
Joined: Wed Jun 27, 2007 9:44 am
Location: Sofia, Bulgaria

Post 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.... :cry:
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.
There are 10 types of people in this world, those who understand binary and those who don't
sxgomezf
Forum Newbie
Posts: 9
Joined: Mon Oct 01, 2007 3:48 pm

Post 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. :(
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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;
sxgomezf
Forum Newbie
Posts: 9
Joined: Mon Oct 01, 2007 3:48 pm

Post by sxgomezf »

Thanks feyd. I ran the code I this is what i got.

'' doesn't exist!

What does it mean?
jeffery
Forum Contributor
Posts: 105
Joined: Mon Apr 03, 2006 3:13 am
Location: Melbourne, Australia
Contact:

Post 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
sxgomezf
Forum Newbie
Posts: 9
Joined: Mon Oct 01, 2007 3:48 pm

Post 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.
sxgomezf
Forum Newbie
Posts: 9
Joined: Mon Oct 01, 2007 3:48 pm

Post 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"
User avatar
feyd
Neighborhood Spidermoddy
Posts: 31559
Joined: Mon Mar 29, 2004 3:24 pm
Location: Bothell, Washington, USA

Post 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.
Post Reply