Skip to main content

This site requires you to update your browser. Your browsing experience maybe affected by not having the most up to date version.

DataObjectManager Module

Discuss the DataObjectManager module, and the related ImageGallery module.

Moderators: martimiz, UncleCheese, Sean, biapar, Willr, Ingo, swaiba, simon_w

Uploadify: "HTTP Error"


Go to End
Reply

14 Posts   11678 Views

Avatar
UncleCheese

16 February 2011 at 4:14pm 4085 Posts

Hey, everyone,

Well, we all know how annoying this error can be, and I thought I'd share some possible fixes. First, let's clarify why this happens.

Uploadify uses a Flash object to handle the uploading of a file, and then copies the file to the server by invoking a PHP script. When errors happen executing that HTTP request to the PHP script, we don't get much to go on. Flash can only really tell us that the server came back with an error code (not 200).

To help debug, you can use UploadifyField::show_debug(); in your _config.php. This will not only show you how the Uploadify widget is configured, but also force some text into the server response so that you can get more than just a 500 code if something fails, and it will show that text in an alert box. This doesn't always work, however, especially if the error happens before the controller is executed.

Here are some tips on troubleshooting:

1) Make sure error reporting is cranked up, and that "display_errors" is on in php.ini

2) Download [url=http://www.charlesproxy.com/]Charles[/url] or [url=http://www.wireshark.org/]Wireshark[/url] (I like Charles) to packet sniff the server response. With a little bit of digging, you should be able to get the response and see an error.

3) If you get a 400 code (bad request), chances are you have mod_security running, and it might be set a little too paranoid. You can talk to your sysadmin to either turn it off, or better yet, turn it down to be more tolerant of Flash requests.

4) If you get a 302 (redirect) response, it means Flash didn't carry over the session through PHPSESSID, and you're therefore not authenticated in the CMS to do the upload. This is the most common and most troubling result, but I have managed to fix this on three separate occasions with the same fix:

If you are on Rackspace "cloud" hosting

This can help you. You need to change your session.save_path setting.

First, find out your document root, using Director::baseFolder(); It should look something like this:

/mnt/stor1-wc1-dfw1/534534/23234/your_site.com/...

Create a directory at the same level as your_site.com called "sessions". It should be ABOVE the web root.

Add this to your .htaccess:

php_value session.gc_probability 1
php_value session.gc_divisor 100
php_value session.gc_maxlifetime 3600
php_value session.save_path /mnt/xxx/xxx/xxx/your_site.com/sessions

Where the "xxx" is for you to fill in according to your actual document root.

Who knows why, but for some reason, Rackspace cloud hosting has very weird session handling with Flash.

Feel free to add any of your own solutions below!

Avatar
xini

11 March 2011 at 6:29pm Community Member, 8 Posts

Hi UncleCheese,
I actualy get either no response (Remote server closed the connection before sending response header) or a 406 Not Acceptable (Client browser does not accept the MIME type of the requested page) uploading jpg files with the ImageUploadField.
As client Charles shows "Shockwave Flash" as the user agent.
I am using silverstripe 2.4.5 and just upgraded DOM and uploadify to the latest releases (not to the current trunk though).
Do you have any idea what the problem could be here?
Thank you very much.

Avatar
Maariak

18 March 2011 at 10:56pm (Last edited: 18 March 2011 11:11pm), Community Member, 20 Posts

What should I do with response code "403 Forbidden"...? It says "You don't have permission to access /xxx/admin/EditForm/field/AudioFiles/UploadifyForm/field/UploadedFiles/upload
on this server"

Avatar
Maariak

21 March 2011 at 7:27am Community Member, 20 Posts

And I'm wondering the thing, that there's actually no folders with that path in my xxx-folder, no folder called admin and those folders under it. Do I have something in wrong folder?

Avatar
Maariak

26 March 2011 at 6:08am Community Member, 20 Posts

Still wondering this problem. And I can't upload files through Files & Images either, the same HTTP error appears.

Avatar
okotoker

26 March 2011 at 9:54am (Last edited: 26 March 2011 10:08am), Community Member, 41 Posts

I am having the same 403 error and cannot find the folders either. Did you figure this out?

**Solved but with question

I googled about mod_security I found this to add to my .htaccess file and everything went ok.
<IfModule mod_security.c>
###########################################
# disable POST processing to not break multiple image upload

SecFilterEngine Off
SecFilterScanPOST Off
</IfModule>

However my question as I don't know much about this module to know if disabling this is a good idea? What are the potential consequences?

Avatar
Maariak

26 March 2011 at 9:53pm (Last edited: 26 March 2011 9:55pm), Community Member, 20 Posts

I've tried that aswell, and the "HTTP error" doesn't appear after trying to upload a file, but also there's no file in "Attached files" below and it does nothing when I push Continue, so I have to just close the window with Close button (that's in Audiopage I created). In Files & Images I can upload a mp3-file, "HTTP error" text doesn't appear, but it doesn't show any attached files below. But when I push the Close button to close the window, uploaded file does appear to the filelist. So can I somehow add a file uploaded from Files&Images to my Audiopage? Well of course it would be better to get this problem solved to make it possible to upload a file directly from Audiopage..

Avatar
Maariak

26 March 2011 at 11:02pm Community Member, 20 Posts

I've tried different browsers before, but now I got audiofile to my Audiopage with Mozilla, when I uploaded the file with Upload new -tab, and when it doesn't appear to attached files, I opened Choose existing -tab, and the file was in the list, and importing from there got the file attached.. So attaching problem isn't solved, have to search other topics about that subject, the "HTTP error" isn't bothering anymore.

But I would also like to know the answers to okotokers questions about the consequences.

Go to Top