Problem with filefield module after migrating drupal site to a new server: cant upload files

Posted by oalo on Stack Overflow See other posts from Stack Overflow or by oalo
Published on 2010-05-10T17:31:51Z Indexed on 2010/05/10 17:34 UTC
Read the original article Hit count: 283

Filed under:
|
|

We have a content type with two imagefield / filefield fields, and after migrating our site to a new server, we have the following problem:

When we submit a new item for this content type, with two images for those fields, drupal gives us the following error and does not upload the images:

warning: fopen(sites/default/files/.htaccess) [function.fopen]: failed to open stream: Permission denied in /websites/sitename/data/sites/all/modules/filefield/field_file.inc on line 349. warning: fopen(sites/default/files/.htaccess) [function.fopen]: failed to open stream: Permission denied in /websites/sitename/data/sites/all/modules/filefield/field_file.inc on line 349. An image thumbnail was not able to be created. warning: fopen(sites/default/files/.htaccess) [function.fopen]: failed to open stream: Permission denied in /websites/sitename/data/sites/all/modules/filefield/field_file.inc on line 349. warning: fopen(sites/default/files/.htaccess) [function.fopen]: failed to open stream: Permission denied in /websites/sitename/data/sites/all/modules/filefield/field_file.inc on line 349. An image thumbnail was not able to be created.

I understand this is a permissions error, but it is not clear to me where do I have to change permissions. Line 349 of file.inc has the following code:

if (($fp = fopen("$directory/.htaccess", 'w')) && fputs($fp, $htaccess_lines)) { fclose($fp); chmod($directory .'/.htaccess', 0664); } else { $repl = array('%directory' => $directory, '!htaccess' => nl2br(check_plain($htaccess_lines))); form_set_error($form_item, t("Security warning: Couldn't write .htaccess file. Please create a .htaccess file in your %directory directory which contains the following lines:
!htaccess", $repl));

© Stack Overflow or respective owner

Related posts about drupal

Related posts about drupal-6