FileField Upload Issue

Events happening in the community are now at Drupal community events on www.drupal.org.
defiantbyte's picture

I recently deployed a site to a BOA instance using a custom platform built using a custom platform w/ a Pressflow 6 core. Unfortunately I can't seem to get the FileField AJAX uploader to work. The uploads hit 100% and then respond with an HTTP error 0.

  • All of our tests show that if you click submit the file will upload successfully.
  • They AJAX uploader does actually upload the file, it just responds with an HTTP error 0 once the upload reaches 100%

I have the filefield, and filefield_nginx_progress modules installed and they appear to be working normally so I'm leaning towards this being server related. Some of the things I've tried:

  • Modifying the nginx confs in the Octopus user directory. (client_max_body_size, etc.)
  • Modifying the var/aegir nginx confs
  • Modifying the PHP-FPM confs
  • Recreated the CCK FileField

Again, the files are uploading but the progress bar widget hits 100% and then HTTP Error 0. I'm not sure if this will help but switching the FileField to use a throbber as opposed to the progress bar doesn't seem to have an effect. The page always uses a progress bar.

Any help or insight would be appreciated.

Comments

Fixed the issue.

defiantbyte's picture

We solved this problem, and I thought it might help to post how we found the problem. It seems a lot of people have the HTTP error 0 issue and I think when you start running a custom stack it can be hard to pinpoint where the issues are. Is it NGINX? PHP-FPM? Module conflict? JQuery? etc..

Our issue turned out to be caused by a custom module. The module altered the content type create form to validate if the user was allowed to do the upload. This wasn't a simple permission check as it also depended on the state of a related content type. If it was determined that the user wasn't allowed to upload, they were redirected to the home page with a message saying such. <- THIS

So when the FileField widget finishes its upload there is a redirect or submit of sorts. Sorry I don't have the full details. When the widget requested via Ajax the HTML to replace the upload form with, it hit our validation and actually pulled the home page with the message set. Which caused the HTTP error 0, because it expects JSON not HTML.

We found this by using Chrome's development tools (Firebug will do as well) and placing a breakpoint in ahah.js where it returns the error. This is line 90 for Drupal 6.22 with Jquery Update installed. When it breaks, you can see your response. In our case it showed a bunch of HTML and we saw the HTML for the message in place.

BOA

Group organizers

Group notifications

This group offers an RSS feed. Or subscribe to these personalized, sitewide feeds: