File Upload works but only for empty file 
January 16th, 2007, 10:35 PM
| | | | re: File Upload works but only for empty file
Arthur Jacobs wrote: 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 | 
January 16th, 2007, 10:45 PM
| | | | re: File Upload works but only for empty file
Rik wrote: Quote:
Arthur Jacobs wrote:>
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 | 
January 17th, 2007, 12:05 AM
| | | | 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:>
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.
| | 
January 17th, 2007, 12:15 AM
| | | | 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 | 
January 17th, 2007, 12:45 AM
| | | | re: File Upload works but only for empty file
On 2007-01-16 16:09:28 -0800, "Rik" <luiheidsgoeroe@hotmail.comsaid: 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>";
?> | 
January 17th, 2007, 12:55 AM
| | | | 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: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 | 
January 17th, 2007, 01:45 AM
| | | | 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:>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 | 
January 17th, 2007, 09:25 PM
| | | | 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
| |  | | | | /bytes/about
We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights.
Get the best answers to your questions from over 225,702 network members.
|