One issue that cited this error, along with another, was marked as duplicate and closed. The issue it was supposedly a duplicate of was marked as fixed back in february, and doesn't actually seem to address this particular error. Seemed best to open a new issue devoted specifically to this issue, but if not, I can reopen one of the others.

On bulk upload, I'm getting the following error. Anywhere from 2 to perhaps a dozen files will upload before the error stops. The uploader ticks through all the uploading files before closing as if successful, at which point the PHP error becomes visible.

The specified file temporary://p161t0h1ok1aujt5q1o9n14b64iab.tmp could not be copied, because no file by that name exists. Please check that you supplied the correct filename.

• PDOException: SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry '' for key 'uri': INSERT INTO {file_managed} (uid, filename, uri, filemime, filesize, status, timestamp) VALUES (:db_insert_placeholder_0, :db_insert_placeholder_1, :db_insert_placeholder_2, :db_insert_placeholder_3, :db_insert_placeholder_4, :db_insert_placeholder_5, :db_insert_placeholder_6); Array ( [:db_insert_placeholder_0] => 39 [:db_insert_placeholder_1] => [:db_insert_placeholder_2] => [:db_insert_placeholder_3] => application/octet-stream [:db_insert_placeholder_4] => 0 [:db_insert_placeholder_5] => 1 [:db_insert_placeholder_6] => 1307717626 ) in drupal_write_record() (line 6851 of/var/www/vhosts/test.d7.local/httpdocs/includes/common.inc).

I am using:

- 7.x-1.0-beta3 (appears to have the patches discussed in the closed issues)
- plupload 1.4.3.2

Anyone else experienced this issue? Found a workaround or fix?

Comments

wrd’s picture

Hm. I am not experiencing this error when performing the same upload in two different server environments. Difference is PHP 5.3.x on the working servers, PHP 5.2.x on the non-working server. I'll see if I can get the admin on the dev server to upgrade PHP and find out if that makes the difference.

wrd’s picture

OK, I've managed to rule out the PHP version; was able to duplicate the error on PHP 5.3.

wrd’s picture

So, interestingly enough, eliminating Plesk from the test environment makes this problem go away. I have no idea how or why, but if anybody else is experiencing it, and can do without Plesk, it may solve your problem.

David_Rothstein’s picture

If by any chance this is a server setup with multiple web nodes (unlikely but possible), the 'plupload_temporary_uri' variable needs to be set to a location that is shared between the servers (the default /tmp won't work)...

I think another possible cause here is something like #1230632: hard-coded file size limits.

slashrsm’s picture

Status: Active » Postponed (maintainer needs more info)

Was this fixed?

mrmwebmax’s picture

Version: 7.x-1.0-beta3 » 7.x-1.0

+

I'm experiencing the same problem as was originally described, above, on a client website using the latest Plupload on the latest Drupal 7, with Media and Media Gallery. The site is hosted on Rackspace Cloud, which recently upgraded from PHP 5.2.x to PHP 5.3.14. I'm convinced that the problem started with the PHP upgrade.

Basically, I can drag-and-drop only one file into the upload window and successfully upload. Any more than one file generates the exact error described in the original post. Any idea if the problem is with the module, with Plupload itself, or both? Is a fix in sight?

slashrsm’s picture

Status: Postponed (maintainer needs more info) » Active

Currently I have no idea whether it is Plupload module, library or any other module you mentioned. Will try to reproduce it, but any other useful info would be more that welcome.

slashrsm’s picture

Have you checked solution proposals in #4?

drupalninja99’s picture

We have prod with 5.3 not working and dev 5.2 working.

SMRussell’s picture

Version: 7.x-1.0 » 7.x-1.1

I am having similar problems. Lots of "The specified file ... could not be copied" errors. I'm using plupload with File Field Sources to populate a custom gallery node type. PHP version is 5.3.25.

One observation: the first upload seems to work fine for each new gallery. Later uploads usually fail. Either the new images are not added, or they appear later, or the upload hangs after reaching 100%.

I've watched my tmp directory and noticed that, for my latest gallery, the files from my first upload where there for a period of time afterwards. Is the problem some interaction with image caching?

I'd love a solution. I'm not looking forward to uploading a few hundred images one at a time.

Thanks.

aaronschachter’s picture

#4 resolved this issue for me. It was working fine locally but not on the prod site, which uses multiple web heads.

suldan’s picture

Could someone specify #4?
Does it mean that plupload needs a tmp-folder outside the root?

ps identical installation works on php 5.3.25 but does not on php 5.4.17. Both with plupload library 1.5.7.

thecoalman’s picture

I'm getting this same error, I upgraded my Plesk panel which also upgraded php to 5.3.3. It was working prior to that and it also works on my local machine which is using php 5.4.7.

I have all the current releases of:

Drupal
FileField Sources
FileField Sources Plupload
Plupload integration

plupload is version 1.5.7

What will work:

  • Any sized single file using the standard upload, e.g it can be 200MB and it doesn't fail becsue I have some really high limits set in the php.ini
  • A single file less than 1MB when using plupload .

What won't work:

  • Any file more than 1MB using plupload.
  • Multiple files using plupload.

If I upload a single file using plupload that is larger than 1MB the uploaded file is only 1MB and the image is truncated.

Multiple small files are hit and miss, a few might be successful.

anthonydc’s picture

Referring to #4
"If by any chance this is a server setup with multiple web nodes (unlikely but possible), the 'plupload_temporary_uri' variable needs to be set to a location that is shared between the servers (the default /tmp won't work)..."
I am experiencing this issue with my host Pantheon. Where do you set the location for plupload_temporary_uri variable?

slashrsm’s picture

plupload_temporary_uri is set to "temporary://" by default. You most likely want to leave it this way and configure core's configuration for temporary:// scheme to point on some place, which is shared between all webheads.

wrd’s picture

Sorry to take so long to check in: I have not experienced this problem since we set up shared storage for the temporary upload directory on our cluster.

Anjaro’s picture

Hi

I have also this problem, but i dont understand the solution.

What do i have to change and where ?

Thanks for listening.
Anjaro

slashrsm’s picture

Status: Active » Fixed

@Anjaro: you should configure central file storage and configure all webheads to use it for temporary storage. This problem appears when you have more webservers and every of them using local temporary storage.

Status: Fixed » Closed (fixed)

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

geerlingguy’s picture

Another confirmation (#4, #18, et all) that if you're using a multi-host environment (e.g. Acquia Cloud, AWS, Pantheon, bespoke, etc.), then you need to use a shared mount/directory for the temporary files directory to resolve this issue, as the file is uploaded in a separate request from the one that copies the file from the temporary directory to the 'files' directory—therefore in some cases, the second request could be on a different server, and would cause the copy to fail without a shared temp directory.

prophet108’s picture

If you are hosted on Acquia cloud, you can use this module that was written to solve this issue: https://www.drupal.org/project/acquia_cloud_sticky_sessions

jenlampton’s picture

I'm on Acquia hosting, but the Acquia Cloud Sticky Sessions module does not solve the problem. If anyone has any other suggestions, I'd love to hear them.

Update: Acquia actually recommends *not* using the Acquia Cloud Sticky Sessions module. Instead they recommend setting the `plupload_temporary_uri` variable in your settings.php (though how one figures out what the temp directory should be is beyond me, so I asked them).

here's what I added to my settings.php:

// Check for Acquia environment.
if (array_key_exists('AH_SITE_ENVIRONMENT', $_ENV)) {
  // Set shared temp directory so multi-file uploads will work.
  $conf['plupload_temporary_uri'] = "/mnt/gfs/{$_ENV['AH_SITE_GROUP']}.{$_ENV['AH_SITE_ENVIRONMENT']}/tmp";
}

I was warned that this directory might not actually exist, and if that was the case I would need to SSH into the server and create it myself.

aprohl5’s picture

I can confirm that JenLampton's solution (#22) worked for the Acquia multi-site that I manage.

gurunathan’s picture

The solution #22 worked fine in the Acquia environment. Thanks

Chris Charlton’s picture

kobb’s picture

Thanks Jen!

The solution #22 works in the Acquia environment.

iyyappan.govind’s picture

I am facing same problem please help me to fix this issue. I am using Plesk hosting server. It is working fine my local machine.

rocket777’s picture

Ran into this issue on our internal server environment running more than one web node.
Setting $conf['plupload_temporary_uri'] to a shared folder fixed it for us.

DrPal43’s picture

rocket777 Im new to drupal. How did you do this? Can you show an example $conf['plupload_temporary_uri'] to set it to a shared folder?

nanobyt3’s picture

As descriped in #22, setting $conf['plupload_temporary_uri'] worked for me too. Thank you!
I used .www_tmp directory, as it already existed, as below:

$conf['plupload_temporary_uri'] = "/mnt/gfs/{$_ENV['AH_SITE_GROUP']}.{$_ENV['AH_SITE_ENVIRONMENT']}/.www_tmp";
swtweb’s picture

Check your file system settings. In my case the Temporary Directory path was set to incorrect folder.

/admin/config/media/file-system

For Linux temp folder set to "/tmp"