Even though this issue was closed twice, the bug still isn't fixed:
http://drupal.org/node/329913
http://drupal.org/node/297035

You can't just close an issue without providing a solution! Please do not close this issue unless a fix is provided.

Here is a step by step description how to reproduce this bug. Any Browser and any Server will work. I have tried this a lot.

1) set up clean drupal install
2) install cck
3) install filefield 3.0-alpha7
4) goto Home › Administer › Content management › Page
5) add new field: Type "File" and Operations "Fileupload" label and field_label "file"
6) save
7) in global settings on the next page set "Number of values: " to "unlimited"
8) save
9) goto node/add/page
10) You now see two fields for files: select a file but don't hit upload yet
11) hit "Add another item"
12) JS-alert pops up which says:
An HTTP error 0 occurred.
/filefield/ahah/page/field_file/0

Hitting "save" displays json code, which should have been evaluated when i had hit the "Add another item" button. Then all input is lost. Very frustrating....

Again: Do not close this issue, unless a reliable fix is provided

All i know that it's related to the /misc/ahah.js which throws this error.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

dopry’s picture

I have observed this myself finally... :) I can consistently reproduce it. The problem is CCK provides this functionality... not filefield...

If you click the upload button, then the save button everything works out ok.

eikes’s picture

I know that it works if you upload first, but tell that to an editor after he lost his work of an hour or two... :P

What I'm thinking is, that this error pops up when an ahah request ist made but the page (or iframe) is closed before the response was received.

Here's a thought: What if the pressing of "Add another item" was intercepted with jquery and all "upload" buttons are invoked which haven't been uploaded yet. After they're done the actual proccess of adding another item is started.

My knowledge about the inner workings of CCK and filefield are too limited to see if that's a viable solution or to implement it. What do you think though?

dopry’s picture

I started looking more.. the two differences in the form submission that should be pursued for isolating the issue.

1) File uploads go through an IFRAME in the background, so when a file is selected an IFRAME is used for the 'Add Another Item' button.
2) The content_add_more_js callback and filefield_js callbacks are implemented slightly differently. Which is correct and which isn't is a
completely different issue.

Since the 'Add Another Item' button works when an iframe isn't used I'm more suspect of the XHR vs. IFRAME issues... the modified handling in filefield_js may be a direct result of the IFRAME submit vs XHR.

kruser’s picture

I'm seeing this error with same setup as above, but uploading I'm just uploading single PDF file. The strangest thing is that it appears to be triggered by the contents of the body field? See if this test works for you:

1. create a new node with the body containing the following code, then save it:
<p>Simply selecting the Automatic Job Setup function on the DS-1000&rsquo;s large, easy-to-use touch screen display automatically programs the processing of new jobs in seconds, saving you valuable setup time on new and repeat orders. It takes less than two minutes to change from a </p>

2. Edit the same node and upload a PDF (this is when I get the ahah error)

An HTTP error 0 occurred. 
/filefield/ahah/showcaseproduct/field_pdf/0

Now, for me if I delete the word "from", click save, then click edit, then upload a PDF - it works. Any idea how removing the word "from" could have an impact on this error?

This is the strangest thing I'm ever seen.

kruser’s picture

I solved my "from" issue - There is an apache module called modsecurity that filters for hacker stuff, which was inadvertently causing my "An HTTP error 0 occurred" error.
http://drupal.org/node/110219

quicksketch’s picture

I inadvertently fixed this in #387194: FileField UI Refactoring. It now seems to have the behavior described in #2:

Here's a thought: What if the pressing of "Add another item" was intercepted with jquery and all "upload" buttons are invoked which haven't been uploaded yet. After they're done the actual process of adding another item is started.

In other words, clicking "Add another item" effectively uploads all the files which have currently been selected. If you could try out the latest dev and check that it works for you, I'd appreciate it.

quicksketch’s picture

Status: Active » Fixed

Between the above patch, #370015: Upload issue with clicking 'Add another item' multiple times (Repost w/ screencast), and #372401: Merge only needed FileField Drupal.settings, I'm fairly sure this issue is solved. I'm marking this fixed, but please try out the development version and reopen if this is still a problem.

mudd’s picture

For me, upgrading FCK Editor to the latest version stopped the "HTTP error 0 occurred" problem with FileField. (both FCK and the Drupal wrapper -- I had been on fckeditor-6.x-1.3-rc6 + FCKeditor_2.6.3 but I'm now on fckeditor-6.x-2.0-alpha5 + FCKeditor_2.6.4)

eikes’s picture

Status: Fixed » Active

This issue has not been resolved. I tested it on a clean install of Drupal 6.10 and Filefield 3 Dev. Still there

PLEASE, DON'T MARK IT AS FIXED IF IT'S NOT! I described the steps to reproduce the error above. It's easily tested. So please do so before changing the status.

Also: It's unrelated to FCKEditor, it's a problem with how cck handles the "Add another item" and how the filefield is submitted. or something like that.

quicksketch’s picture

Status: Active » Fixed

I wouldn't close it if I didn't think it was fixed. I'm able to test and complete the entire workflow described at the top of this issue. Everything worked fine for me. As dopry said in #q this was a bug caused by CCK, not FileField. It was fixed already. The reason I couldn't reproduce it is because I was running the latest 2.x version of CCK, in which the problem is fixed. The problem is not fixed in the 2.1 version of CCK.

Here's the issue in which this was fixed: #370004: content_add_more_js breaks with file uploads.. You can apply this patch to the 2.1 version and it'll fix your installation also. Obviously, the fix will be included in the 2.2 version of CCK.

eikes’s picture

I'm sorry, I didn't realize, that i needed the cck dev version. with that it works.

Thank you very much!

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.

snorkers’s picture

Version: 6.x-3.0-alpha7 » 6.x-3.0-rc1
Status: Closed (fixed) » Active

Err... I'm seeing this problem in CCK 2.2 now and FF3rc1. Should I still use CCK 2.x dev to get around this problem, or is there still a CCK/FileField problem waiting to be rectified?

quicksketch’s picture

This particular problem was fixed in CCK 2.2. Unless you can reproduce the problem following the exact workflow Eikaa outlined at the top of this issue, please open a different one (with a new workflow for reproducing). I can no longer reproduce this problem, so you'll need to provide more details about how to make the problem appear.

snorkers’s picture

Actually - just answered this myself - error still occurs even with CCK2.x dev (Apr 7). However, is this the same error? I get a massive JS alert box on a site with a lot of content - about 3 screens deep - and not able to read it all. I screen-captured a fraction of the top of the alert message. Maybe this is useful..?

quicksketch’s picture

Status: Active » Closed (fixed)

snorkers, let's keep this issue closed. As it was a specific problem that has already had a solution to fix it.

JordiTR’s picture

I'm also having exactly this problem, although I have the official last release for CCK, imagefield and filefield. I've been reading this post for a while to see if there was a solution but after uploading to my site all the last (official) versions I'm still having the same problem (with drupal 6.10).

h3000’s picture

FileSize
77.01 KB

Hi,

I'm also having the same problem. I am currently using latest version of CCK - 6.x-2.2.

Same settings as described in the first post:

- I have a content type with a field of type file
- number of values was set to unlimited
- when adding a node, I can click on the upload button for the field - it works, and the image is uploaded fine
- however, when clicking on the add another item button, I get the error.

My setup is:
CCK 6.x-2.2
Drupal 6.11
Apache2
PHP5
MySQL5

Attached is a screenshot:

childofgaia’s picture

Problem fixed if I disable FCKeditor on the same page!
FCKeditor uses iframes alot...

Had the same problem but not with "Add another" button. The same issue occured when adding a single file.

My setup:

FCKeditor 6.x-1.3
CCK 6.x-2.2
Drupal 6.11
Apache2
PHP5
MySQL5

ricardoruiz’s picture

Same issue when attempting to upload an image to an ImageField.

Drupal 6.13
CCK 6.x-2.4
ImageField 6.x-3.1
Apache 2.2.8
PHP 5
MySQL 5

valerycolong’s picture

Using ImageField and ImageField_Crop, I had same issue with http 0 error when I clicked on upload on ImageField.
I solved the issue by increasing the memory size in Drupal using ini_set('memory_limit', '256M'); in settings.php.
I hope this helps.

ergophobe’s picture

In my case, I needed to add

*/ahah/* to my SecurePages "ignore" list - the http/https switchover was causing this error.

[edit: scratch that - it worked once, I guess randomly - and now doesn't work again; I've seen others report that his fixed the problem for them though].

I'm getting a 404 when I look at my logs:

75.107.96.58 - - [29/Sep/2012:15:25:32 -0700] "POST /filefield/ahah/gallery/field_gallery_image/54 HTTP/1.1" 404 8833 "http://www.example.com/node/284/edit" "Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.4 (KHTML, like Gecko) Chrome/22.0.1229.79 Safari/537.4"