• Welcome to the Chevereto user community!

    Here users from all over the world gather around to learn the latest about Chevereto and contribute with ideas to improve the software.

    Please keep in mind:

    • This community is user driven. Be polite with other users.
    • We recommend purchasing a Chevereto license to participate in this community.
    • Purchase a Community Subscription to get even faster ticket response times.

I'm getting 406 error when uploading

Status
Not open for further replies.

WhisperiN

Chevereto Member
Hello fellows,

I'm new to Chevereto, I've installed it and configured all necessary variables and parameters.
It's working, but it's not uploading pictures.

When I try to upload any thing, it gives: HTTP Error (406)
and a note: No image has been uploaded.

My server is running PHP as Fast-CGI, and PHP process can read/write to images folder (upload folder).

I just have issue with uploading, since uploading via URL is working just fine..!!
Fileupload is not disabled in my php.ini, this is really driving me crazy.

Kindly, help..!!
This is more than appreciated.
- Regards
 
If just local upload is failing it tells me that there are some weird error with the configuration.

If you are in Apache try to add this to the Chevereto's root .htaccess

Code:
SetEnvIfNoCase Content-Type "^multipart/form-data;" "MODSEC_NOPOSTBUFFERING=Do not buffer file uploads"
 
Oh.. Finally..!! I'm able to upload..!!

Just to let you know, every body.. the issue was related to Mod_Security.
Actually, the code you provided didn't solve the issue.. but, you pointed me to check Mod_Security.

Here is the complete error logged:

Code:
[Sun Sep 30 00:02:11 2012] [error] [client xx.xx.xx.xx] ModSecurity: Access denied with code 406 (phase 2). Pattern match "^Shockwave Flash" at REQUEST_HEADERS:User-Agent. [file "/usr/local/apache/xxx/xxxx/xxxx"] [line "212"] [hostname "xxxxx.xxx"] [uri "/chevereto/upload.php"] [unique_id "UGeMAj5LzBwAABU0FhMAAAAB"]

I tried to upload files with Mod_Security disabled on this path, and it worked..!!

I came to another issue,
Files are being uploaded with permission: 600
While thumbs are OK, holding permission: 644

I'm running nginx on my servers, as reversed proxy, under user XXXX, and uploaded files are owned by another user ZZZZ.
They should be holding 644 permission, so any suggestions ?!

Regards
 
PHP assigns the permission according to "what permission does have PHP". The script will try to fix the permissions to 0644 but if PHP can't apply that permission it will stuck to 600 because that is the default on PHP. Since thumbs have the 644 it tells me that the issue could be the PHP rename function because in that way the images are pushed to the final destination. This means to me that you should investigate about the rename function and the permission 0600.

On class.upload.php you can remove the @ from this code (and set error_reporting true on config.php):

PHP:
// Change the CHMOD of the file (for some php enviroments)
@chmod($image_filename, 0644);
@chmod($thumb_filename, 0644);

Doing that you will know why PHP can't apply that permission mask.
 
Again, you are being so helpful..!! 🙂

mentioning the chmod, this was one of the functions I've disabled in my php.ini

Thanks a lot, issue is resolved.

[How can I change the Pending to Resolved?]
 
Oh.. ok .. lol

Thought it's like some other forums, where you TAG your thread as resolved or solved once it becomes.

Thanks Danny..
 
Status
Not open for further replies.
Back
Top