473,794 Members | 2,880 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

File Upload works but only for empty file

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
9 3205
On Tue, 16 Jan 2007 14:10:10 -0800, Arthur Jacobs <st**@sonic.net wrote:
>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.u k :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Jan 16 '07 #2
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
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_PART IAL
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
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.comsai d:
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
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
On 2007-01-16 16:09:28 -0800, "Rik" <lu************ @hotmail.comsai d:
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_FILE S should be used instead
// of $_FILES.

$uploaddir = '/usr/home/arthur/public_html/game/test/uploads/';
$uploadfile = $uploaddir . basename($_FILE S['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
Rik
Arthur Jacobs wrote:
On 2007-01-16 16:09:28 -0800, "Rik" <lu************ @hotmail.comsai d:
>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
On 2007-01-16 16:47:54 -0800, "Rik" <lu************ @hotmail.comsai d:
Arthur Jacobs wrote:
>On 2007-01-16 16:09:28 -0800, "Rik" <lu************ @hotmail.comsai d:
>>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
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.net said:
On 2007-01-16 16:47:54 -0800, "Rik" <lu************ @hotmail.comsai d:
>Arthur Jacobs wrote:
>>On 2007-01-16 16:09:28 -0800, "Rik" <lu************ @hotmail.comsai d:
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
4000
by: lion | last post by:
I get these errors when uploading images via a web page: (the page still uploads the images but reports these errors?) Warning: fopen(D:\php\uploadtemp\php1FC7.tmp) : failed to create stream: No error in D:\webspace\me.co.uk\wwwroot\test\Live.php on line 105 Warning: Wrong parameter count for filesize() in D:\webspace\me.co.uk\wwwroot\test\Live.php on line 109
4
2945
by: Tihon | last post by:
Hello! I again need your help, just can't understand whats going on. Got this upload pictures form and it's having problem handling large files (~1.5 - 2 MB). Everything works fine if i just upload files, like this: copy ($myfile, $uploadfolder . "/" . $myfile_name); Everything works fine, it can process large files and everything, but i need to make sure that people only upload pictures, so i change
1
4680
by: balzano_1 | last post by:
Hi, im trying to upload a file from a client (windows) to an ftp server (linux), i deciede to use some of php`s functions to connect and authenticate etc.. i only wish to put a file on the server, so i used ftp_put() function, when i send the file via http, the file is created on the server, but it is empty, i checked the permissions and all are set correctly, i figured if it is empty it means it cant find the file im trying to upload, i...
13
4324
by: Sky Sigal | last post by:
I have created an IHttpHandler that waits for uploads as attachments for a webmail interface, and saves it to a directory that is defined in config.xml. My question is the following: assuming that this is suppossed to end up as a component for others to use, and therefore I do NOT have access to their global.cs::Session_End() how do I cleanup files that were uploaded -- but obviously left stranded when the users aborted/gave up writting...
2
3438
by: mark | last post by:
How do I detect that a particular form element is a file upload or if the file upload has worked? In the Python cgi module documentation I found suggested code... form = cgi.FieldStorage() fileitem = form if fileitem.file: # It's an uploaded file; count lines
5
3737
by: Jefferis NoSpamme | last post by:
Hi all, I'm trying to limit the file size of an image submission and I keep running into various problems. I've got most of it working, but I'm stumped and I have a basic question as to WHY this works at all! if ($_FILES !="") { if ($_FILES<=0) { header("Location: /fileerror.php"); exit; }
1
2724
by: pbd22 | last post by:
hi. i have been posting this here and elsewhere a lot and can't seem to get resolution on this problem. i have been trying to upload files using a hidden iframe to a asp.net/vb.net form. the problem is that the server code can't read the httpfilecollection. the count is always zero. my upload form's form tag looks like this:
3
19885
by: markus.rietzler | last post by:
i want to do (multiple) file upload(s) and display a progress bar. with firefox and safari it is no problem at all. only IE makes some problems. my script is based on ajax-uploader, which can be found at www.srmiles.com/freestuff/ajax_file_uploader/ . you can do multiple file uploads. each upload will have it's own "form"-tag, so that each file is uploaded for its own. could be a good solution if there are "big" uploads.
7
7158
Curtis Rutland
by: Curtis Rutland | last post by:
Building A Silverlight (2.0) Multi-File Uploader All source code is C#. VB.NET source is coming soon. Note: This project requires Visual Studio 2008 SP1 or Visual Web Developer 2008 SP1 and Silverlight 2.0. To get these tools please visit this page Get Started : The Official Microsoft Silverlight Site and follow Step 1. Occasionally you find the need to have users upload multiple files at once. You could use multiple FileUpload...
0
9672
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9519
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10435
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10163
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10000
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
5563
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4113
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3721
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2920
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.