When I try to upload files I get the following error in red:

File upload error. Could not move uploaded file.
There was an error uploading the "Wateraid News_0.pdf" attachment.

I guess this could be a mime mail problem, but I'm not sure, can't find another issue that matches this one.

Files are not making it to the upload folder sites/default/files/emailattachments
I've checked that the temp directory is ok incase that was the problem.

here are the error messages that come up in logs...which might lead to some helpful advice?

Type php
Date Tuesday, December 11, 2012 - 12:13
User admin
Location http://www.circleofsong.co.uk/mass_contact
Referrer http://www.circleofsong.co.uk/mass_contact
Message Warning: mkdir() [function.mkdir]: No such file or directory in DrupalLocalStreamWrapper->mkdir() (line 639 of /home/sites/circleofsong.co.uk/public_html/includes/stream_wrappers.inc).
Severity warning
Hostname 94.195.160.161
Operations

Type php
Date Tuesday, December 11, 2012 - 12:13
User admin
Location http://www.circleofsong.co.uk/mass_contact
Referrer http://www.circleofsong.co.uk/mass_contact
Message Warning: move_uploaded_file(public://sites/default/files/emailattachments/Wateraid News_0.pdf) [function.move-uploaded-file]: failed to open stream: "DrupalPublicStreamWrapper::stream_open" call failed in drupal_move_uploaded_file() (line 1601 of /home/sites/circleofsong.co.uk/public_html/includes/file.inc).
Severity warning
Hostname 94.195.160.161
Operations

Type php
Date Tuesday, December 11, 2012 - 12:13
User admin
Location http://www.circleofsong.co.uk/mass_contact
Referrer http://www.circleofsong.co.uk/mass_contact
Message Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move '/tmp/php0ngSjR' to 'public://sites/default/files/emailattachments/Wateraid News_0.pdf' in drupal_move_uploaded_file() (line 1601 of /home/sites/circleofsong.co.uk/public_html/includes/file.inc).
Severity warning
Hostname 94.195.160.161
Operations

Type file
Date Tuesday, December 11, 2012 - 12:13
User admin
Location http://www.circleofsong.co.uk/mass_contact
Referrer http://www.circleofsong.co.uk/mass_contact
Message Upload error. Could not move uploaded file Wateraid News_0.pdf to destination public://sites/default/files/emailattachments/Wateraid News_0.pdf.
Severity notice
Hostname 94.195.160.161
Operations

Type mass_contact
Date Tuesday, December 11, 2012 - 12:13
User admin
Location http://www.circleofsong.co.uk/mass_contact
Referrer http://www.circleofsong.co.uk/mass_contact
Message There was an error uploading the "Wateraid News_0.pdf" attachment.
Severity error
Hostname 94.195.160.161
Operations

Comments

oadaeh’s picture

It will help greatly if you have access to the HTTP server logs, as that will probably give you the exact reason why it can't move the file.

The first thing I would check is that sites/default/files/emailattachments exists and is writable by the HTTP server, either as the owning user or as a member of the owning group. Read the "a. Missing files directory." section of the INSTALL.txt for details.

If you did not manually create the directory, the server should have created the directory, and it should have the correct permssions, but that could have been changed since then.

It is also possible that the permissions for sites/default/files are not correct, but then you would have other errors, like from Ctools. Check that in admin/config/media/file-system.

Something you can try, if sites/default/files/emailattachments exists, is to delete or rename it and then go to admin/config/system/mass_contact/settings/body and save the configuration. If there is a problem, you should get an error message. If you don't, then the directory should have been created correctly. Then try sending another message with an attachment to see if you get the error again. If you do, then it probably has something to do with the temp directory.

kruser’s picture

I had this issue too after upgrading to D7 form D6. It turns out I had the upload directory (on admin/config/system/mass_contact/settings/body ) set to "site/default/files/mass_contact_attachments", but it only needed to be "mass_contact_attachments" because "public://" already is "sites/default/files".

oadaeh’s picture

Status: Active » Fixed

Thank you, kruser, for you help and input with this. I have added your information to the README.txt file, both in the Troubleshooting section and in a new Upgrading From 6.x section.

I also added and upgrade option for it, but only for when the default is left as is.

Status: Fixed » Closed (fixed)

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