Hi,

I have spent several hours trying to solve a problem with filefield and imagefield combined to upload images. I have enabled version 6.x-3.9 of both modules but of course this error message originates from inside filefield.

The image upload works on the install of the site on my PC and most things are the same, eg Drupal version but it doesn't work on the server. phpinfo tells me that post_max_size and upload_max_filesize are both set to 128MB and all other relevant variables appear to be set to relevant values. (on the server)

When I attempt to debug the script I find that the $_POST array in filefield_js() is empty. This is rather unusual. I believe this is generated from ahah.js and have reuploaded all the /misc scripts in case something was corrupted. Is this array empty when there is a filesize problem? Do I have to look further at my server to see what upload configurations are not set in order to solve this? Form_cache appears to be working.

This is an unusual problem and I have not met anything like it in three years of using this module. Any insight would be appreciated.

Thanks

Kent

Comments

quicksketch’s picture

Category:bug» support

Your host is probably enforcing a cap through another PHP extension (usually Suhosin) that is preventing the 128MB setting from taking effect. If the $_POST array is empty, this isn't a problem with FileField, it's that PHP is truncating the $_POST array because it is too big, regardless of the setting that you've set. I'd suggest contacting your hosting provider

New Zeal’s picture

Thanks for the response. Despite most of the day working on it we have failed to find a reason but I am now wondering if the apache / php build being used on the particular server might be a cause. The build is represented by the following in admin/reports/status:

Apache/2.2.14 (Unix) mod_ssl/2.2.14 OpenSSL/0.9.8e-fips-rhel5 DAV/2 mod_bwlimited/1.4 Phusion_Passenger/3.0.2 mod_perl/2.0.4 Perl/v5.8.8

This seems a little unusual to me. There's no mention of php but then I am not an apache server expert.

New Zeal’s picture

Status:Active» Fixed

Problem solved by finding new webhost.

Thanks

Status:Fixed» Closed (fixed)

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

New Zeal’s picture

Actual problem found.

Having moved to the new server, the problem began to recur and so had to have another go at troubleshooting it. Finally I found the cause was an Apache urlrewrite rule as follows:

# Add a trailing / if missing
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteRule (.*)$ http://www.mysite.com/$1/ [R=301,L]

This was obviously screwing up the javascript http requests made by the filefield module and so I added some extra conditions to get the following:

# Add a trailing / if missing
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteCond %{REQUEST_URI} !(\.[a-zA-Z0-9]{1,5}|/)$
RewriteCond %{REQUEST_URI} !filefield\/(.*)$
RewriteCond %{REQUEST_URI} !upload\/(.*)$
RewriteRule (.*)$ http://www.mysite.com/$1/ [R=301,L]

Now it works.