Connecting Tech Pros Worldwide Help | Site Map

File Upload works but only for empty file

Arthur Jacobs
Guest
 
Posts: n/a
#1: Jan 16 '07
Good Day,

I can upload a file as long as it is empty (thanks Hendri Kurniawan).
I do not know where to look.

Can someone help me understand what I need to do to upload a small image.
http://chops.novatrope.com/game/test/upload_file3.php

Here is some more info http://chops.novatrope.com/info.php

Thanks,
Arthur Jacobs

Andy Hassall
Guest
 
Posts: n/a
#2: Jan 16 '07

re: File Upload works but only for empty file


On Tue, 16 Jan 2007 14:10:10 -0800, Arthur Jacobs <star@sonic.netwrote:
Quote:
>I can upload a file as long as it is empty (thanks Hendri Kurniawan).
>I do not know where to look.
>
>Can someone help me understand what I need to do to upload a small image.
http://php.net/results.php?q=upload+file

--
Andy Hassall :: andy@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Rik
Guest
 
Posts: n/a
#3: Jan 16 '07

re: File Upload works but only for empty file


Arthur Jacobs wrote:
Quote:
Good Day,
>
I can upload a file as long as it is empty (thanks Hendri Kurniawan).
I do not know where to look.
>
Can someone help me understand what I need to do to upload a small
image. http://chops.novatrope.com/game/test/upload_file3.php
>
Here is some more info http://chops.novatrope.com/info.php
Perhaps:
upload_tmp_dir no value

It should take the systems default if nothing is set, but maybe there's
something wrong with it. Try to make a tmp dir, chmod 0766, set it as
upload_tmp_dir, and try again. If that doesn't work, maybe try 0777.

The rest of the values all seem OK.
--
Rik Wasmus


Rik
Guest
 
Posts: n/a
#4: Jan 16 '07

re: File Upload works but only for empty file


Rik wrote:
Quote:
Arthur Jacobs wrote:
Quote:
>Good Day,
>>
>I can upload a file as long as it is empty (thanks Hendri
>Kurniawan). I do not know where to look.
>>
>Can someone help me understand what I need to do to upload a small
>image. http://chops.novatrope.com/game/test/upload_file3.php
>>
>Here is some more info http://chops.novatrope.com/info.php
>
Perhaps:
upload_tmp_dir no value
>
It should take the systems default if nothing is set, but maybe
there's something wrong with it. Try to make a tmp dir, chmod 0766,
set it as upload_tmp_dir, and try again. If that doesn't work, maybe
try 0777.
>
The rest of the values all seem OK.
If I construct a form to post I get a:

UPLOAD_ERR_PARTIAL
Value: 3; The uploaded file was only partially uploaded.

So it indeed seems a write issue on the server side.

Oh, and if that doesn't work, please share the code with us. I can browse
http://chops.novatrope.com/game/test/, but I cannot see the code :-).
--
Rik Wasmus


Arthur Jacobs
Guest
 
Posts: n/a
#5: Jan 17 '07

re: File Upload works but only for empty file


Thanks Rik,
I will tell you what I did but it does not seemed to have helped. I added
upload_tmp_dir = "/usr/tmp";
to my php.ini file
Then I restarted apache and tried to upload
and when I try to upload I get the infamous: Error: 3

Any more ideas I am all ears and eyes!

Thanks,
Arthur

On 2007-01-16 14:28:43 -0800, "Rik" <luiheidsgoeroe@hotmail.comsaid:
Quote:
Arthur Jacobs wrote:
Quote:
>Good Day,
>>
>I can upload a file as long as it is empty (thanks Hendri Kurniawan).
>I do not know where to look.
>>
>Can someone help me understand what I need to do to upload a small
>image. http://chops.novatrope.com/game/test/upload_file3.php
>>
>Here is some more info http://chops.novatrope.com/info.php
>
Perhaps:
upload_tmp_dir no value
>
It should take the systems default if nothing is set, but maybe there's
something wrong with it. Try to make a tmp dir, chmod 0766, set it as
upload_tmp_dir, and try again. If that doesn't work, maybe try 0777.
>
The rest of the values all seem OK.

Rik
Guest
 
Posts: n/a
#6: Jan 17 '07

re: File Upload works but only for empty file


Arthur Jacobs wrote:
Quote:
Thanks Rik,
I will tell you what I did but it does not seemed to have helped. I
added upload_tmp_dir = "/usr/tmp";
to my php.ini file
Then I restarted apache and tried to upload
and when I try to upload I get the infamous: Error: 3
>
Any more ideas I am all ears and eyes!
Does /usr/tmp exists?
Is /usr/tmp writable? What permissions do you have exactly?
Does the 'empty' file get uploaded to that location now?

And why does you php_info() still say "upload_tmp_dir no value no value"?
Have you edited /usr/local/etc/php.ini or another .ini file?

If that's all OK, what happens if you try to make a file with php itself in
/usr/tmp? Any errors?

And last but not least: what's the code you use?
--
Rik Wasmus


Arthur Jacobs
Guest
 
Posts: n/a
#7: Jan 17 '07

re: File Upload works but only for empty file


On 2007-01-16 16:09:28 -0800, "Rik" <luiheidsgoeroe@hotmail.comsaid:
Quote:
Does /usr/tmp exists?
I think so it showed up in my ftp program.
Quote:
Is /usr/tmp writable? What permissions do you have exactly?
yes 0777
Quote:
Does the 'empty' file get uploaded to that location now?
Yup, I just tested it. It returns:
Upload: empty.html
Type: text/html
Size: 0 Kb
Stored in: /var/tmp/phpBKG7BF
Quote:
>
And why does you php_info() still say "upload_tmp_dir no value no value"?
This is a good question. I am new to php so I am not sure.
Quote:
Have you edited /usr/local/etc/php.ini or another .ini file?
usr/local/etc/php.ini
/////////////////////////////////////////////////////////////////
I see now the permissions did not change, sorry, let me try again and I
will get back to you pronto:
/////////////////////////////////////////////////////////////
Quote:
>
If that's all OK, what happens if you try to make a file with php itself in
/usr/tmp? Any errors?
>
And last but not least: what's the code you use?
<?php
// In PHP versions earlier than 4.1.0, $HTTP_POST_FILES should be used instead
// of $_FILES.

$uploaddir = '/usr/home/arthur/public_html/game/test/uploads/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);

echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
echo "File is valid, and was successfully uploaded.\n";
} else {
echo "Possible file upload attack!\n";
}

echo 'Here is some more debugging info:';
print_r($_FILES);

print "</pre>";

?>

Rik
Guest
 
Posts: n/a
#8: Jan 17 '07

re: File Upload works but only for empty file


Arthur Jacobs wrote:
Quote:
On 2007-01-16 16:09:28 -0800, "Rik" <luiheidsgoeroe@hotmail.comsaid:
Quote:
>Does /usr/tmp exists?
I think so it showed up in my ftp program.
Quote:
>Is /usr/tmp writable? What permissions do you have exactly?
yes 0777
Quote:
>Does the 'empty' file get uploaded to that location now?
Yup, I just tested it. It returns:
Upload: empty.html
Type: text/html
Size: 0 Kb
Stored in: /var/tmp/phpBKG7BF
/var/tmp is _not_ /usr/tmp
--
Rik Wasmus


Arthur Jacobs
Guest
 
Posts: n/a
#9: Jan 17 '07

re: File Upload works but only for empty file


On 2007-01-16 16:47:54 -0800, "Rik" <luiheidsgoeroe@hotmail.comsaid:
Quote:
Arthur Jacobs wrote:
Quote:
>On 2007-01-16 16:09:28 -0800, "Rik" <luiheidsgoeroe@hotmail.comsaid:
Quote:
>>Does /usr/tmp exists?
>I think so it showed up in my ftp program.
Quote:
>>Is /usr/tmp writable? What permissions do you have exactly?
>yes 0777
Quote:
>>Does the 'empty' file get uploaded to that location now?
>Yup, I just tested it. It returns:
>Upload: empty.html
>Type: text/html
>Size: 0 Kb
>Stored in: /var/tmp/phpBKG7BF
>
/var/tmp is _not_ /usr/tmp
Sorry this is beyond me a little. I know var/tmp is not usr/tmp, but I
thought that "Stored in" may have been the temporary place where the
computer made the temporary file.

I have a tmp folder in root that has a file created today. I think
that is where the uploads are going but I am not sure.

Sorry I wish I was more help but all your help is appreciated!

Thanks,
arthur

Arthur Jacobs
Guest
 
Posts: n/a
#10: Jan 17 '07

re: File Upload works but only for empty file


Happy days are here again....
Good Day,

In case you run into this problem again have the person make sure their
var/log dir is not full. Mine was overflowing, and that was the whole
problem (my fault-no excuse). I want to thank you guys and gals for
your patience and help!

serene at last,
~arthur


We were getting close to the problem it had to do with the log files on
the server. On 2007-01-16 17:38:21 -0800, Arthur Jacobs
<star@sonic.netsaid:
Quote:
On 2007-01-16 16:47:54 -0800, "Rik" <luiheidsgoeroe@hotmail.comsaid:
>
Quote:
>Arthur Jacobs wrote:
Quote:
>>On 2007-01-16 16:09:28 -0800, "Rik" <luiheidsgoeroe@hotmail.comsaid:
>>>Does /usr/tmp exists?
>>I think so it showed up in my ftp program.
>>>Is /usr/tmp writable? What permissions do you have exactly?
>>yes 0777
>>>Does the 'empty' file get uploaded to that location now?
>>Yup, I just tested it. It returns:
>>Upload: empty.html
>>Type: text/html
>>Size: 0 Kb
>>Stored in: /var/tmp/phpBKG7BF
>>
>/var/tmp is _not_ /usr/tmp
>
Sorry this is beyond me a little. I know var/tmp is not usr/tmp, but I
thought that "Stored in" may have been the temporary place where the
computer made the temporary file.
>
I have a tmp folder in root that has a file created today. I think
that is where the uploads are going but I am not sure.
>
Sorry I wish I was more help but all your help is appreciated!
>
Thanks,
arthur

Closed Thread