I am having a problem uploading files for logged in users. User 1 works fine.

My logs show the error as:
type: access denied
message: filefield/ahah/fac_staff_profile/field_photo/0

The user I am testing has all access privileges to all permissions.

Is this a permission setting that needs to be set on the web server?

Drupal 6.13
PHP 5.1.6
PHP memory limit 128MB
Apache/2.2.3 (Red Hat)

Comments

easp’s picture

Below is a snip from Firebug of the issue. Logging in as user 1 does not display this error.
Looks like to me the problem is javascript errors that start a chain reaction with other modules.

I will try to fix the imce error and report back how that effects the filefield error.

logs is null
anonymous("An HTTP error 0 occurred. <br />/filefield/ahah/athletic_photo/field_photo/0", "error")imce.js?U (line 528)
anonymous(Object type=ajaxError target=document, Object, Object url=/filefield/ahah/athletic_photo/field_photo/0, SyntaxError: syntax error message=syntax error)imce.js?U (line 665)
anonymous(Object type=ajaxError target=document)jquery.j...val/seq/1 (line 1)
anonymous()jquery.j...val/seq/1 (line 1)
anonymous("ajaxError", [Object type=ajaxError target=document, Object, Object url=/filefield/ahah/athletic_photo/field_photo/0, 1 more... 0=Object 1=Object 2=Object], Document athletic-photo, true, Object name=i)jquery.j...val/seq/1 (line 1)
anonymous()jquery.j...val/seq/1 (line 1)
anonymous(Object length=641 0=html.js 1=head 2=meta 3=title 4=meta, function(), Object name=c)jquery.j...val/seq/1 (line 1)
anonymous(function(), Object name=b)jquery.j...val/seq/1 (line 1)
anonymous("ajaxError", [Object, Object url=/filefield/ahah/athletic_photo/field_photo/0, SyntaxError: syntax error message=syntax error 0=Object 1=Object 2=SyntaxError: syntax error], Object name=b)jquery.j...val/seq/1 (line 1)
anonymous("ajaxError", [Object, Object url=/filefield/ahah/athletic_photo/field_photo/0, SyntaxError: syntax error message=syntax error 0=Object 1=Object 2=SyntaxError: syntax error], Object name=f, Object name=g, Object name=i)jquery.j...val/seq/1 (line 1)
anonymous(Object url=/filefield/ahah/athletic_photo/field_photo/0, Object, "error", SyntaxError: syntax error message=syntax error)jquery.j...val/seq/1 (line 1)
cb()jquery.f...val/seq/2 (line 1)
[Break on this error] logs.appendChild(div);\n
easp’s picture

Title: File upload access denied » File upload access denied - SOLUTION

I found the problem.

I was using CCK's content permission module. On the content type that had the filefield I had another field that was being blocked by the content permission module.

Looking through the filefield module it looks like it checks permissions on each field in the content type. If access is denied on any of the fields then the filefield module gets the access denied.

I hope this helps someone else that has been battling this same access denied problem.

Roi Danton’s picture

Title: File upload access denied - SOLUTION » File is uploaded but not added to the field since access to filefield/ahah is denied
Version: 6.x-3.x-dev » 6.x-3.1
Category: support » bug

I had the same problem without the usage of content permission and not using IMCE (using content permission and allow access to all fields doesn't help in my case):

Steps (widget type image/ImageField):

  1. Select an image.
  2. Click on upload.
  3. A javascript alert box appears with the message: HTTP error 0 occurred. /filefield/ahah/%content_type/%field_name/%field_valuenumber

The image is uploaded on the server but not added to the field.

Log warning message:
type: access denied
content: filefield/ahah/%content_type/%field_name/%field_valuenumber

Roi Danton’s picture

Title: File is uploaded but not added to the field since access to filefield/ahah is denied » File is uploaded but not added to the field since access to filefield/ahah is denied (HTTP error 0)

One of the reasons could be the lack of PECL uploadprogress or APC (the Filefield project page sounds as if these libraries are optional).

This issue has been discussed extensively several times:
#297035: HTTP error 0
#297460: Image upload causes 'HTTP error 0'
#329913: still HTTP error 0
#356916: HTTP error 0. /mysite/?q=filefield/ahah/audio_mp3/field_mp3/0
#432038: FCKEditor Causes "HTTP error 0" Preventing Upload
#473760: HTTP 0 error when uploading ANY file
#501980: Image API
Related to these discussions the reasons which cause "HTTP error 0" are quite different:

  • Sometimes the problem is tracked down to memory issues, e.g. caused by Suhosin, or GD memory consumption (instead of IM)
  • or lacking of installed libraries like PECL uploadprogress/APC
  • or to other potentially "dangerous" modules (FCK or other Javascript modules)
  • or to other CCK fields in the content type
  • or it depends on browser/browser plugins

Since in my case it works for user 1 (but not for other users) and php scripts have enough ressources and only the modules required for filefield (no editor or similar) are installed and the HTTP error 0 also occurs on fresh content types without fields, the reason might be directly related to bugs in Filefield code.
However in my case it does depend on the used browser: The error occurs in Opera but not in Firefox (with many plugins). Perhaps there is a direct relationship between several reasons (available memory, enabled modules, used browser). Only in certain combinations this error occurs.

A detailed discussion about FAPI AHAH and file upload issues can be found in Module development discussions: Form API - AHAH + file field type

chris_herbrand’s picture

I am fairly new to drupal and was working with the photo gallery from the book "Using Drupal" with author O'reilly.

I have run in to this same issue and decided to play around a bit with the browsers. I tried it in safari it worked just fine but with firefox it was giving me this error. I decided to disable all javascript through the web developer toolbar and it works fine. Anyone have any suggestions that would involve me being able to enable javascript again on firefox and still fix this error? Thanks in advance for any suggestions.

alcoder’s picture

I have ImageField, ImageCache and ImageApi modules installed. I use Firefox. This error happened to me when I was uploading larger images. For small images everithing worked correctly. I have solved this problem by setting the PHP memory_limit to 96M (previously it vas 32M). I am quite new to Drupal, but I think the error was that 32M memory wasn't enough to generate the thumbnail for the images.

quicksketch’s picture

Status: Active » Closed (duplicate)

Let's keep this consolidated, we inevitably get a dozen different reasons every time this comes up. #473760: HTTP 0 error when uploading ANY file.