Just done a fresh install of D6 on some siteground space and it's all running fairly well except when I try to attach any file to a new page - when I click Attach the file is uploaded and then an alert comes up saying "An HTTP error 0 occurred\n/cms/upload/js". The file is uploaded and finds its way into the /sites/default/files directory OK (as per the config in "administer"). Any ideas why?

Also is this the only/main way to get files uploaded in D6 if I want to embed IMG SRC links in page content?

RB

Comments

rburr49’s picture

IE7 seems fine. Is nobody else getting this? It seems to relate to an ahah function seeing an HTTP status of 0 and treating it as an error...

RB

polaris-1’s picture

I am experiencing the same problem when trying to upload any file as an attachment to a page, and it is pretty frustrating. The file gets uploaded fine both through IE7/Firefox, but the error occurs every time!

Please someone look into this and come up with a fix!

polaris-1’s picture

Is this HTML status error related to my .htaccess file in any way? I really like Drupal, but this attachment error is a deal-breaker and I may have to move to a different platform if I cannot get it resolved.

I am running Drupal 6 on a Linux-based server, using IE7 for administration of the site.

Thanks for the help!

dmcmeans’s picture

I'm getting the same error using FireFox on Drupal 6.1. The file is uploaded. Thought it might have something to do with spaces in the filename, but it does not. I'm using a private file system. I'm using Windows Vista. I checked, and the upload does work using IE 7 (7.0.6).

Tommy Sundstrom’s picture

I get the same error with Safari on a mac.

Tommy Sundstrom’s picture

I uploaded the same file from another page. After that I was able to upload it on the original page.

(I'm not sure if the solution was the extra upload, or if the problem self-solved by some kind of timeout.)

OwlsNest’s picture

Drupal 6.x, Win XP Pro SP2, FF & IE 7

I get the same error on ALL my pages.

I get the error and the file DOES NOT upload at all.

The file progress bar looks like it's doing something but it's not doing anything.

I have been just dropping img src tag directly into the body to add my images.

RoboPhred’s picture

Same error. However, it seems to eventually work if I keep pressing the attach button after every failure.

I have tried this twice so far, and both times it has worked on the third try.

Ecrofirt’s picture

Oh good lord, I'm not the only one this is happening to! I thought I was going crazy.

This is a major, major issue. When I was using Drupal 6.0 I had no issues, but I upgraded to 6.1, and the issues have been happening since.

I've made sure my php.ini allows for file uploads that large, and each of my user types is able to upload files that are larger than what I'm trying to upload.

greenmother’s picture

I has this error only in Opera, and not always, but sometimes.

Solution in last version of plugin jquery.form.js.
Try to download last version from
http://jqueryjs.googlecode.com/svn/trunk/plugins/form/jquery.form.js
and replace misc/jquery.form.js by it.

Reasons of this bug described by plugin authors, in jquery.form.js at rows 228-229:

// In Opera 9.2.x the iframe DOM is not always traversable when
// the onload callback fires so we give Opera 100ms to right itself
SkinnerSE’s picture

This did not solve the problem for me (running XP, Apache 2.2.8 & Drupal 6.2 with Image module added)

Wojtek Kruszewski’s picture

I also had this error only in Opera.

I tested the site on three PCs with the same version of Opera. I've never seen this error message on two of them, and on third one it kept showing up every single time.

Computer I noticed the problem in differed from two others in that it had Windows 2000 instead of XP and older hardware (P3 700Mhz).

This bug reminds how much testing our web sites and apps need.

Anyway, updating jquery.form.js solved the problem.

Thanks for the tip!

emok’s picture

GreenMother's link solved it for me too. (Opera 9.27 on Linux).
Unfortunately the new jquery.form.js is not "packed", so it's 21 kB rather than 6.3 kB. But I guess I can live with that since it works.

greenmother’s picture

you can pack it (and other javascripts) here:
http://dean.edwards.name/packer/
but sometimes some packed scripts works incorrectly

farez’s picture

Same problem here too when using FF (2.0.0.14) with Drupal running on Linux. Works fine in IE7, and works fine with both FF and IE7 when running Drupal locally on my Windows machine.

Have replaced jquery.form.js as per GreenMother's suggestion but no joy.

Not sure where to start looking.

Anyone found a solution to this yet?

Farez

farez’s picture

Not sure if I've narrowed it down but it took a good few hours of Firebugging, which took me to line 2896 in jquery.js (version 1.2.6):

if ( type == "json" )
  data = eval("(" + data + ")");

The call stack at this point is:

jquery.form.js : line 256, data = $.httpData(xhr, opts.dataType);
jquery.js : line 2896, data = eval("(" + data + ")");

The problem is that 'data' is an empty string, and this is throwing an exception. This exception is then caught by line 258 in jquery.form.js, which then pops up the error alert box.

The value was taken from the 'xhr' object's 'responseText' member variable that was passed into the $.httpData function, and this variable is empty. I'm assuming that this should have something in it as returned from the upload module?

Farez

greenmother’s picture

This error can occurs when php generate php-error or php-warning on ajax-page and this error displayed in browser (display_errors = On in php.ini). Results will be is not correct JSON in this case. Look apache logs after Error 0 occurs, path to solution can be there.

-Anti-’s picture

I know what causes this error with respect to the Drupal interface
(as opposed to knowing what the bug is in a script somewhere):

In Administer > Site configuration > File uploads

If you leave 'Maximum resolution for uploaded images' set to zero, the http 0 error occurs on affected systems.
If you edit that setting to contain a value such as 400x400, there is no error.

NOTE:
My problem occurred on win2000 with the latest Opera, FF, and IE6.
Replacing the suggested js file (above) did not help the problem on Opera or FF, but *did* fix IE6.

I'll leave someone else with more knowledge than me to decide whether this should be a bug report or not.

Cheers.

Ecrofirt’s picture

That's not the case for me at all.

The problem seems to occur with large files for me. I can upload small files without any issues, but if I try to upload a large file I get errors.

I either get an HTTP 0 error as described by everyone, or the file will look like it uploaded without issue. If the file looks like it uploaded without issue, I get errors when I hit the save button to publish the page to the site. I'll get a blank page when I hit save, and the whole post is effectively lost.

The ONLY way I've been able to get around the issue is to turn Javascript off when I want to upload stuff to the site. For whatever reason, that stops the issue from happening.

dirtabulous’s picture

This seemed to fix it for me.
D6.4, Vista, FF2&3

rantenki’s picture

I had the exact same problem with my install, and found that the file was uploading correctly, and that the file was appearing in the files folder as expected, but the session didn't seem to know about it.

I had configured my drupal install to use InnoDB tables so that I only had row locks instead of table locks when updating user sessions (for speed). Since this means that we can have a race condition between the page reload on the user side and the database update for their session, I tried an experiment...

I discovered that when I wrapped the session save handler with a transaction, the problem went away (along with a strange login failure bug I thought was unrelated).

Index: /drupal/trunk/includes/session.inc
===================================================================
--- /drupal/trunk/includes/session.inc (revision 6)
+++ /drupal/trunk/includes/session.inc (revision 16)
@@ -71,8 +71,11 @@
     // table rows without breaking throttle module and "Who's Online" block.
     if ($user->uid || $value || count($_COOKIE)) {
+      db_query('start transaction');
       db_query("INSERT INTO {sessions} (sid, uid, cache, hostname, session, timestamp) VALUES ('%s', %d, %d, '%s', '%s', %d)", $key, $user->uid, isset($user->cache) ? $user->cache : '', ip_address(), $value, time());
+      db_query('commit');
     }
   }
   else {
+    db_query('start transaction');
     db_query("UPDATE {sessions} SET uid = %d, cache = %d, hostname = '%s', session = '%s', timestamp = %d WHERE sid = '%s'", $user->uid, isset($user->cache) ? $user->cache : '', ip_address(), $value, time(), $key);
 
@@ -82,4 +85,5 @@
       db_query("UPDATE {users} SET access = %d WHERE uid = %d", time(), $user->uid);
     }
+    db_query('commit;');
   }
 
@@ -103,6 +107,8 @@
 
   session_regenerate_id();
+  db_query('start transaction;');
 
   db_query("UPDATE {sessions} SET sid = '%s' WHERE sid = '%s'", session_id(), $old_session_id);
+  db_query('commit;');
 }

Obviously, the InnoDB is not a "normal" configuration of Drupal, but it really makes a difference for the speed of the user session data. I have not benchmarked since to see if this change destroys any speed advantage.

Odotnet’s picture

Try turning off 'Optimize JS / CSS files' in Performance.. see if that helps.

tuanpham’s picture

Also, after replacing new jquery.form.js, remember to clear your cache. It works in my case.

Nicolasdec’s picture

I also have this problem. It ushaly happens when i try to upload larger files. I set the php.ini to allow uploads to 100mb. but i still get the problem. I tried it in Firefox 2 and 3, Safari and IE 7. All of them same problem. Is there anyway to fix this?

cybershan’s picture

I also have this problem in D6.4, when I log in as administrator, it works fine, but when log in as Editor, this problem appears.

(I have assigned the related permission to Editor role.)

Any other idea?

joergent’s picture

I also got this error in every browser.
It turned out to be caused by the PHP memory limit when GD was scaling the picture needing more memory than allowed.
PHP.INI:
memory_limit = 24M ; Maximum amount of memory a script may consume

cybershan’s picture

Thanks Joergent,

I changed memory_limit to 128M, but still appear that error message.

blazeb’s picture

I also got this error in every browser.
I clicked Save button, BUT I FORGET to click ATTACH button before, and it works!

lennonseno’s picture

this works for me too. thanks blazeb!

joachim’s picture

Just got this error and I think it was a caching problem -- the admin/settings/uploads page wasn't available either.

raff77’s picture

Is this not to do with edit permissions on certain users?

aaronbauman’s picture

I'm running D6.10, FF 3.06, OSX.5
I recently installed jqBrowser, which broke file attachments for me.

Upgrading to the latest version of jquery.form.js (v2.21) resolved this issue for me....
Haven't seen any additional errors due to this upgrade yet.

hth,
/a

jayboodhun’s picture

Hi,
I tried replacing the jquery.form.js in the /misc folder but the file attachment error was still occuring. Then i figured out the jquery.form.js was being used by other modules i have installed. For example advpoll module. By replacing these modules folders' jquery.form.js file that fixed the problem.
The new jquery.form.js file is available here:
http://jqueryjs.googlecode.com/svn/trunk/plugins/form/jquery.form.js

dkaswan’s picture

Thanks jayboodhun,
replacing advpoll module's jquery.form.js file with latest version fixed my problem.

Anonymous’s picture

So apparently a person needs to make sure that every module that includes its own jquery.form gets the latest version... because that fixed all of my problems.

Skipsey-1’s picture

None of the jquery solutions worked for me. I noticed a similar problem trying to upload files through fckeditor, but this gave far more useful errors and I was able to figure out that I needed to enable Write access to the /tmp and /sites/default/files foders. All seems to work fine now.

noisephoenix’s picture

this is driving me crazy too. when I press "upload" I get the HTTP error 0, but if i just save then everything works fine.

FredsFriend’s picture

I was getting this issue and noticed that it was down to the prevent default statements on the submit events for buttons other than the main save button not being fired. So it is obvious that something is breaking jQuery and submitting the form rather than issuing an ajax request. In my case the culprit was Advanced poll including jquery.form.js from its own directory when it was already being included by the admin function. My guess is that by including it twice all of the form event handlers are being overwritten.
If you are getting this issue it is probably worth your time to view the source of your page and see if this file is being included twice. The hard to pin down nature of this issue probably means that it is more than one module doing this.

I resolved my problem by adding "node/add/*" to the Latest poll block exclude path. (i already had admin/* excluded but forgot that in drupal's **** reasoning adding content isn't an admin function)

te-brian’s picture

@ FredsFriend
Glad you fixed your problem. One comment on:

forgot that in drupal's **** reasoning adding content isn't an admin function

The reason adding content is not treated the same as administration is because, in drupal, content is not just pages and posts. Content could be, for example, a product review by a store visitor. The user is "creating a node" but it is clearly not an administrative task, its an end-user task. Just my 2 cents :)

mitchellecohen’s picture

I have had this problem for awhile -- when uploading a file to Scribd I get the error. The file downloads to my ISP fine, but does not upload to Scribd. It is a Firefox problem on my particular computer. When I use IE7 on the same computer it works. When I use Firefox or IE on my laptop the files upload fine. I installed a new version of Firefox and it produces the same error. It may be in the add-ins or the Firefox profile. Any ideas of specifically where to look?

cecshab’s picture

Congratulation~! you have arrived the most difficult part of drupal : the Http error 0 occur !!
Thousand of post going on for this error and it caused by hundreds of reason! The developer just simply hide them all in one 0!
Hopefully you don't need to spend 3650hrs on this problem.
I have working on it for 100hrs and now all browser are working except chrome...And I will give up chrome..advise the user to change the broswer because of this -the happiest part of drupal : upload a file!

Here are the some of the fix, make sure you have tried every one of them, enjoy:

Severside:

Enable/disable Greasemonkey
Set higher Memory limit in php.ini
Enable/disable PECL upload progress

Downgrade filefield module from alpha3 to alpha2
use imagemagick instead of gd image toolkit
Try other browser
Disable advanaced poll or replace the jquery.form.js inside
Disable smarterfox in FF
Disable Devel
Disable Theme developer module
Try install jquery update

Check of durpal got the permission to write in the tmp folder and file folder. (u can check it in admin>file system)

unc0nnected’s picture

Same problem here, I tried installing the latest version of jquery.js as well as the latest version of jquery.form.js and still same error with the comment attachment module. httpd error 0: comment-upload/js .

So what I did try, based on someone elses experience was to turn on Noscript and block everythign on the page.. Lo and behold things started to work.

Long story short I went in, got the 1.2 version of jquery.js , overwrote it in /misc and I'm up and running now.

Blogged about it and posted the long version here:
http://blog.netflowdevelopments.com/2010/07/01/me-myself-and-drupal-chap...

ron2x80’s picture

If you are using Secure pages module, add filefield/progress/* to "Ignore pages:" field

webdevbyjoss’s picture

Reproducing the same issue on Internet Explorer 8 (Win XP) on:

- Drupal 6.22
- jQuery 1.2
- jQuery form plugin 2.01.

Tried to upgrade to:
- jQuery v1.7.1
- jQuery form plugin 2.96

but that doesn't helps.

The problem occurs when I try to upload files larger than ~100K.
There is no any problem for small text files like 1-2Kb or even up to ~100K

But when trying to upload 300K - I receive this strange error Alert displayed:
"An HTTP error 0 occurred\n/upload/js"

Web server error log shows nothing, and even web server access log shows nothing.

BUT web server access log displays successfull POST requests if I upload small files (< 20Kb)
and nothing for file like 300Kb

So it looks like in my case it even doesn't initiates the request to server.

I've installed HTTP sniffer "Fiddler" and it returns error:

"Fiddler has detected a protocol violation in session #453.
Content-Length mismatch: Request Header indicated 382,366 bytes, but client sent 0 bytes."

It looks like IE fails with something like "Out of memory" for large files and doesn't appends body to HTTP requests.

Possibly someone will have any ideas on how to resolve this?

Studio FJ’s picture

We have been dealing with the issue of FileField not allowing us to upload more than 1MB files and giving us a "HTTP error 0 occurred" message for several months, despite upping the servers upload limit and several other tweaks.

We finally reached a SOLUTION yesterday after 40+ hours of troubleshooting. We are on a MediaTemple Dedicated Virtual Server running Drupal 6.26.

We tried the following edits to the php.ini file:
upload_max_filesize = 64M
post_max_size = 32M
memory_limit = 32M
max_execution_time = 300

That didn't work.

We tried implemented several patches from posts on Drupal.org. None of them worked for us.

And finally the SOLUTION for us was to update to the newest jquery.form.js file (released on 11/20/12) in one of the following directories:

/drupal/misc/jquery.form.js

or if you have the JQuery Update module installed:

/drupal/sites/all/modules/jquery_update/replace/jquery.form.js

The newest version can be found at:
http://malsup.github.com/jquery.form.js

Hope this helps!