Unknown error occured, file not uploaded

Having trouble installing serendipity?
Post Reply
Petalo
Regular
Posts: 8
Joined: Thu Aug 19, 2004 12:36 am

Unknown error occured, file not uploaded

Post by Petalo »

Hi,

I'm running v.0.611-cvs and had following error using the add media feature while uploading a little gif from 3 kb:

"Unknown error occured, file not uploaded. Maybe your filesize is larger than the maximum size allowed by your server installation. Check with your ISP or edit your php.ini file to allow larger file size uploads"

I don't expect it to be much but I haven't solved it yet. I checked the php.ini and file uploads are on. It's a default php installation so the filesize shouldn't be the problem.

Is it a maybe httpd.conf thingy? :?
Like livin' on the edge anyway 8)

My configuration:
OS: WindowsXP
MySQL 4018
Apache 1.13
PHP 4
S9Y v.0.611-cvs
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Re: Unknown error occured, file not uploaded

Post by garvinhicking »

Hi Petalo!

This error message only occurs when move_uploaded_file() failed. That's an internal PHP function. Please look at http://www.php.net/move_uploaded_file - do you maybe run PHP in safe mode?

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Petalo
Regular
Posts: 8
Joined: Thu Aug 19, 2004 12:36 am

move_uploaded_file()

Post by Petalo »

Thx Garving,
Read about move_uploaded_file() like you suggested, but it's still a mystery to me, because I assume I upload a valid file (tried several files).
I run also mamboserver (CMS based on PHP) in the same environment. Here uploading and publishing the same stuff isn't a problem. Could moving files be different between the two?
BTW: checked the PHP.INI and "safe mode" is off
:?:
steenslag
Posts: 2
Joined: Mon Aug 30, 2004 1:44 am

Post by steenslag »

Same thing here:

"Warning: move_uploaded_file(): SAFE MODE Restriction in effect. The script whose uid is 10418 is not allowed to access /home/httpd/vhosts/dorinde.nl/httpdocs/kvd/uploads owned by uid 48 in /home/httpd/vhosts/dorinde.nl/httpdocs/kvd/serendipity_admin_images.inc.php on line 155
Unknown error occured, file not uploaded. Maybe your filesize is larger than the maximum size allowed by your server installation. Check with your ISP or edit your php.ini file to allow larger file size uploads."

Apparently it's not happy about a thing called uid. Me too. Nasty rotten little uid.

This is the third install. May be this directory is a remnant of an older installation? (current is Serendipity v.0.6.12-CVS )
Petalo
Regular
Posts: 8
Joined: Thu Aug 19, 2004 12:36 am

UID

Post by Petalo »

Steenslag,

In your case safe mode is on in your PHP.INI and I believe I have read that then some security is in effect.
For troubleshooting purposes you could try to turn safe mode off and see if things work.
tomsommer
Core Developer
Posts: 240
Joined: Tue Sep 02, 2003 6:43 pm
Location: Denmark
Contact:

Post by tomsommer »

It seems the UID of the upload folder does not match the UID of the rest of the scripts, in case you are on a shared server - please ask your systems administrator to change the UID for all your files and folders - so they share the same user.
Tom Sommer (Serendipity Core Developer)
http://blog.dreamcoder.dk
Thomas
Regular
Posts: 130
Joined: Tue Sep 21, 2004 2:00 pm
Location: Stockerau/NÖ/A
Contact:

Post by Thomas »

Hi,

playing around with s9y on W2K I encountered the same problem with the file upload.
I added just before line 155 following line:

Code: Select all

echo $_FILES['userfile']['tmp_name']."<br>\n";
and came along that result:

Code: Select all

C:xampptmpphp4B.tmp
So it seems that the slashes are lost somehow and so the file cannot be found.

The solution lies in the parameter "magic_quotes_gpc". The parameter should be turned off in your working php.ini when running on a Billyboy release. :D

Regards, Thomas
tomsommer
Core Developer
Posts: 240
Joined: Tue Sep 02, 2003 6:43 pm
Location: Denmark
Contact:

Post by tomsommer »

hrm, this might be our fault after all, will look into it :)
Tom Sommer (Serendipity Core Developer)
http://blog.dreamcoder.dk
Thomas
Regular
Posts: 130
Joined: Tue Sep 21, 2004 2:00 pm
Location: Stockerau/NÖ/A
Contact:

Post by Thomas »

Hi,

well, from my point of view you can't do something against when the useris using a Windows platform. The parameter magic_quotes_gpc translates the '\' anyway so $_FILES['myfile']['tmp_name'] well be modified.

Regards, Thomas
tomsommer
Core Developer
Posts: 240
Joined: Tue Sep 02, 2003 6:43 pm
Location: Denmark
Contact:

Post by tomsommer »

afaik, $_FILES['myfile']['tmp_name'] is not affected by _gpc, rather I suspect it is our stripslashes function that is nuking the '\'
Tom Sommer (Serendipity Core Developer)
http://blog.dreamcoder.dk
Thomas
Regular
Posts: 130
Joined: Tue Sep 21, 2004 2:00 pm
Location: Stockerau/NÖ/A
Contact:

Post by Thomas »

Hi Tom,

well I read through again the manual at php.net and didn't find any hint about $_FILES and magic_quotes_gpc.
There's only one note about the tmp_name at the end of that page:
http://www.php.net/manual/en/features.file-upload.php
The message from brion at pobox dot com.

Suggestion: I'll try it out tomorrow and post here the results. Let's see what happens then. :D
Thomas
Regular
Posts: 130
Joined: Tue Sep 21, 2004 2:00 pm
Location: Stockerau/NÖ/A
Contact:

Post by Thomas »

Hi,

well, I tested the case today on my local installation and here are the results.

Here with magic_quotes_gpc enabled but in the file compat.php the $_FILES walkthrough is commented out (line 94-96):

Code: Select all

Array ( [userfile] => Array ( [name] => 0182.jpg [type] => image/jpeg [tmp_name] => C:\XAMPP\xampp\tmp\php1B.tmp [error] => 0 [size] => 42835 ) )
magic_quotes_gpc is: 1
File 0182.jpg successfully uploaded as C:/XAMPP/xampp/htdocs/s9y/uploads/0182.jpg
Thumbnail created.
Done.
The next try I uncommented $_FILES from compat.php (line 94-96) and here's the result:

Code: Select all

Array ( [userfile] => Array ( [name] => 005-4.jpg [type] => image/jpeg [tmp_name] => C:XAMPPxampptmpphp1C.tmp [error] => 0 [size] => 47071 ) )
magic_quotes_gpc is: 1
Unknown error occured, file not uploaded. Maybe your filesize is larger than the maximum size allowed by your server installation. Check with your ISP or edit your php.ini file to allow larger file size uploads.
From my point of view $_FILES should not be modified since $_FILES is a contains the POST properties but from the server side and so the path information for the temporary filename can not be modified on client side.

Regards, Thomas
garvinhicking
Core Developer
Posts: 30022
Joined: Tue Sep 16, 2003 9:45 pm
Location: Cologne, Germany
Contact:

Post by garvinhicking »

Hi Thomas!

You are absolutely right; we received the patch for the stripping some months ago, and implemented it with reverse logic. Instead of only applying the stripslashes for non-windows systems, it applied it for windows systems. I fixed this in our current CVS branch and will put it in the final 0.7 release. :-)

Regards,
Garvin
# Garvin Hicking (s9y Developer)
# Did I help you? Consider making me happy: http://wishes.garv.in/
# or use my PayPal account "paypal {at} supergarv (dot) de"
# My "other" hobby: http://flickr.garv.in/
Petalo
Regular
Posts: 8
Joined: Thu Aug 19, 2004 12:36 am

That's great news!

Post by Petalo »

Great job and well done. Looking forward to 0.7 final! :D

Just updated with latest cvs and I want to show you all:

Serendipity Authoring Suite
Adding image...

File aixlogos.gif successfully uploaded as c:/program files/apache group/apache/htdocs/blog/bestanden/aixlogos.gif
Thumbnail created.
Done
Post Reply