By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,643 Members | 1,797 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,643 IT Pros & Developers. It's quick & easy.

File Upload works but only for empty file

P: n/a
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

Jan 16 '07 #1
Share this Question
Share on Google+
9 Replies


P: n/a
On Tue, 16 Jan 2007 14:10:10 -0800, Arthur Jacobs <st**@sonic.netwrote:
>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 :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Jan 16 '07 #2

P: n/a
Rik
Arthur Jacobs wrote:
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
Jan 16 '07 #3

P: n/a
Rik
Rik wrote:
Arthur Jacobs wrote:
>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
Jan 16 '07 #4

P: n/a
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" <lu************@hotmail.comsaid:
Arthur Jacobs wrote:
>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.

Jan 17 '07 #5

P: n/a
Rik
Arthur Jacobs wrote:
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
Jan 17 '07 #6

P: n/a
On 2007-01-16 16:09:28 -0800, "Rik" <lu************@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
>
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.
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:
/////////////////////////////////////////////////////////////
>
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>";

?>

Jan 17 '07 #7

P: n/a
Rik
Arthur Jacobs wrote:
On 2007-01-16 16:09:28 -0800, "Rik" <lu************@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
--
Rik Wasmus
Jan 17 '07 #8

P: n/a
On 2007-01-16 16:47:54 -0800, "Rik" <lu************@hotmail.comsaid:
Arthur Jacobs wrote:
>On 2007-01-16 16:09:28 -0800, "Rik" <lu************@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

Jan 17 '07 #9

P: n/a
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
<st**@sonic.netsaid:
On 2007-01-16 16:47:54 -0800, "Rik" <lu************@hotmail.comsaid:
>Arthur Jacobs wrote:
>>On 2007-01-16 16:09:28 -0800, "Rik" <lu************@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

Jan 17 '07 #10

This discussion thread is closed

Replies have been disabled for this discussion.