When we recently moved a Drupal 6 site to a new server, we started to see an odd error appear on screen:
The selected file [Filename] could not be copied
Usually the filename was a file located in the Drupal temp directory but we had no idea what was causing the error until further diagnostics were done. Here’s what we did to fix it.
1. Check the permissions in the /sites/default/files directory
Make sure that the Drupal /sites/default/files directory can be written to and modified by the web user. We were using a Windows server, so the IUSR user (in IIS6) had to have the correct security privileges to this folder. If you are using IIS7, the username will probably have changed from IUSR to IIS AppPool\
2. Check both the source and destination file that are trying to be copied
The Drupal error message on screen simply tells you the source file being copied from. First, make sure that the Drupal web user can read this file.
Next, you need to see where Drupal is trying to copy to. This requires a brief edit of the file.inc module in the /includes directory. At around line 259, you are looking for this:
drupal_set_message(t('The selected file %file could not be copied.', array('%file' => $source)), 'error');
Change it to this:
drupal_set_message(t('The selected file %file could not be copied to.', array('%file' => $dest)), 'error');
Now generate the error message again and it will tell you where it is trying to write the file to.
In our case, the ad module was trying to cache a file, but the website move had left an old cache file with the same filename on the server causing the copy to fail. We simply removed the old cache file and Drupal was then able to copy the new file across without generating an error.
If you need any Drupal website help or development work, contact Webopius for more information.
Tags3d Add new tag apple asp aspdotnetstorefront backups bugzilla cgi chrome cloud computing cms content management CRM css Document Management drupal ecommerce expression engine flash google hiring host hosting img_assist interprise JQuery KnowledgeTree mac mamp modules mouse nginx opencart php PRINCE2 printer project management snow leopard ssl tinymce Tips translation unix webgains wordpress