3

I get 404 errors on file uploads on a D7.19 website. The displayed error is the usual oversized file but I'm sure it's unrelated (see below).

Here is the apache log message :

POST /file/ajax/field_photos/und/form-YJgDfzca9S88uWmWhrE2GGYBM_sIEKXLGvVKQD34xeU HTTP/1.1" 404 1563 "http://dev.domain.com/node/add/animal" "Mozilla/5.0 (Macintosh; Intel Mac OS X 10_7_5) AppleWebKit/536.26.17 (KHTML, like Gecko) Version/6.0.2 Safari/536.26.17"

I'm sure the server setup is OK because some other sites hosted on it have AJAX working flawlessly.

Disabling Javascript makes file uploads work OK, so it's definitely some Javascript getting in the way somewhere.

What I tried yet :

  • changing JQuery version (update or no update)
  • put the website in english (prod will be in french)
  • disabling any compression and caching
  • enabling any compression and caching
  • disabling some modules (Superfish, dev modules, UI stuff)
  • different browsers : error is the same everywhere (Safari, Chrome, Firefox).

... and browsed the web like crazy, not finding anything about this precise error.

The only vague hint I have is a file called jquery.cookie whose code doesn't seem to be aliased correctly ((function ($) { // code here })(jQuery); ) but I doubt it could be it.

At this stage, any idea would be welcome. The website is supposed to go live tomorrow (!).

3
  • 1
    does the issue occur on all upload fields or a particular one? Jan 27, 2013 at 10:24
  • All of them. It affects only upload fields, not the other AJAX stuff like Views' and Panels' admin.
    – Countzero
    Jan 27, 2013 at 13:33
  • Just tried latest dev of jquery_update and created a dummy content type tested under Seven theme, to narrow down the problem. Same behaviour. For the record, the error also happens when removing an image to load new version. Log message is the same in that case.
    – Countzero
    Jan 27, 2013 at 13:49

1 Answer 1

2

Solved it !

Explanation :

A file with a name like 'file.xxx' was present at the root of the site. I removed it and everything started to work.

I then put back an empty file named 'file.txt' at the root of the website, and the same error rose again.

It can happen more often than it seems. In my case, I downloaded a patch for the filefield module which was named file_something.patch and forgot to delete it after applying. Easy to do, easy to forget, hard to remember once you've moved on to something else.

Bottomline : keep your webroot clean of anything not Drupal or you're in for trouble. Can't believe I lost two days with such a simple problem.

Thanks to Mohammed Shameem for his try, and to anyone who gave this a thought.

1
  • I had this same error and I too fixed it by removing a file that shouldn't have been there. Using commandline, go to the root of your drupal install and type 'ls -lah'. You can then see all files, including hidden files. You have to determine which files do not belong there and remove them. Feb 19, 2016 at 23:03

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.