Get this message after installing the module on Drupal 5.

The scenario: Install module, activate, add file to post, edit post . . . error as below:
The selected file could not be copied, because no file by that name exists. Please check that you supplied the correct filename

also, when you look at the path to the image, it is missing the file name. as below . . .
This file can be found at http://drupal5/files/.

So, have I messed something up, or is this a bug?

Comments

drewish’s picture

it might be a bug with the image module. you should make sure you can create image nodes without using the upload_image module.

t4him’s picture

Thanks drewish,

I am working with a fresh install of D.5.1 from 03/28/07. A fresh install of image and upload as well. If I disable the upload module it works fine. If I disable it, I get the error.

Can i give you any more info that might help here.

dsnydernc’s picture

this is a known issue with image module. if you check the image module issue section you will see a patch, though it doesn't fully fix it.

t4him’s picture

Thanks slidenby,

I have performed the patch AND downloaded the latest version of image module. Both seem to continue to produce the same results. The image filename is simply getting lost. I am currently looking at a way to abandon the image module. It simply is not stable and it should be. The image module for 4.7.x seemed to stay in a more stable state, but as more and more additions are made for 5.x, it seems there is a learning curve here for module development.

I was just trying to write up a new "recipe" to manage images and produce a slideshow with predictable results. My current thinking is using imagecache and views to produce the slides. If you set views to display as a "list" and only one image per page, it works. My current problem now is that imagecache deals with the images in a slightly different way when resizing., Anyway, that was way off subject.

Thanks for the response, I will continue to monitor this section for solutions that produce a stable image module. Until it is stable, I cannot use it.

dsnydernc’s picture

I'm glad to hear you're thinking about getting away from the image module - the image module has so much potential, but just never seems to manage to live up to it. Though I'm pretty well stuck in with the image module now, having had been using for months and patching all along the way. It now works as I need it to, and with the addition of your module I've more or less built my whole site around the two (a image forum site).

I look forward to seeing what you come up with in the future. It is nice to see module developers coming up with alternative image solutions.

drewish’s picture

t4him, sorry your not happy with the image module but i haven't seen you posting bug reports in its issue queue. i got added as a maintainer a few weeks back and i've committed a ton of bug fixes and closed over 100 bug and support requests. it may not be the right tool for you but it's gotten a lot more stable recently.

t4him’s picture

drewish,
Thanks for the , have you tried a "fresh" install and then performed an import? I am not a module developer. The recipe I was speaking of was in reference to "another" way to create what I need for this project. The problem is with Drupal 5.x / image module and import image. I get the error, and apperently other are too. I did look through the issues that have been posted, this is why I did not issue a bug, It had already been issued. At the bottom of that bug, it was closed and said that the patch had been committed to head. I still have the problem.

I am not trying to create a rift, just trying to get a job done. If I have to wait, I have to wait. I am patient because I am not a programmer and rely on others to get it right. I guess my contribution is to report back when I have an issue. I was just wanting to know if there was a "solid" fix in place yet? So, is this considered fixed?

ericpugh’s picture

Title: The selected file could not be copied, because no file by that name exists. Please check that you supplied the correct filename » I'm getting this error too...

the same error, except it comes up when uploading audio. (audio module)

"The selected file could not be copied, because no file by that name exists. Please check that you supplied the correct filename."

The funny thing is that the uploaded audio is present and playable even though something triggered the error message. ??

Christefano-oldaccount’s picture

Title: I'm getting this error too... » The selected file could not be copied, because no file by that name exists.

Please do not change the title and make it less descriptive. Comments in project issue queues work differently than comments in the forum.

brahms’s picture

I'm sorry, but I think the problem is a bug in the Upload Image module and not in the Image module. I use following modules:

  • upload (from drupal core)
  • image (using the default image path "images")
  • upload image
  • upload preview

Download method is set to public and I am also using the default file system path "files".

I create a new node and attach an image "abc.jpg" to it using the core upload module. When I push the submit button, first the attached image is saved as "files/abc.jpg" by the upload module and an entry is written to the files table. In this entry the filepath column has the value "files/abc.jpg". After that Drupal calls the upload_image_nodeapi of the upload image module. Here the function "upload_image_save" is called and this creates a new image node and the original image "files/abc.jpg" gets saved as "files/images/abc.jpg". The original image "files/abc.jpg" gets lost but the entry for it in the "files" table still shows the filepath "files/abc.jpg" instead of "files/images/abc.jpg"! This is the reason, why you see the error saying "The selected file could not be copied, because no file by that name exists. Please check that you supplied the correct filename". I think the "upload image" module should update the entry in the files table setting the filepath to the right path inside the image path of the image module. (You can try setting this with SQL and the error message is gone).

If you add following code in file upload_image.module (revision 1.17.2.6), between lines 198 and 199 in function upload_image_save, the entries in files table get the right filepath:

db_query("UPDATE {files} set filepath='%s' WHERE fid=%d", $image->images['_original'], $file->fid);

Here is the code from line 198 to line 200, line 199 is the bugfix:

db_query("INSERT INTO {upload_images} (nid, fid, oid) VALUES (%d, %d, %d)", $image->nid, $file->fid, $node->nid);
db_query("UPDATE {files} set filepath='%s' WHERE fid=%d", $image->images['_original'], $file->fid);
drupal_set_message(t('Created image post from your uploaded file %file. You can look and update at it <a href="@url">here</a>.', array('%file' => $file->filename, '@url' => url('node/'. $image->nid))));
giorgio79’s picture

Getting this error message as well, but I use CCK imagefield and imagecache...

killes@www.drop.org’s picture

Version: 5.x-1.x-dev » 6.x-1.x-dev
Status: Active » Fixed

marked #236251: Incongruent filepaths between upload and image upload modules as duplicate.

Applied a fix to the D6-dev branch

Status: Fixed » Closed (fixed)

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

jessia’s picture

Status: Closed (fixed) » Active

I see this issue has been closed for a while, but I'm encountering this error with Drupal 6.13 and 6.x-1.x-dev using Import Image.

The selected file could not be copied, because no file by that name exists. Please check that you supplied the correct filename.
user warning: Duplicate entry '505' for key 1 query: INSERT INTO vdrupal_xmlsitemap_node (nid, changed, previously_changed, comment_ratio, priority_override) VALUES (505, 1247154827, 1247154826, 0, -2) in (path)/includes/common.inc on line 3436.

0 ms After saving new content has been invoked.
0.78 ms Executing the rule Profile has been created on rule set After saving new content
0.857 ms Evaluation of After saving new content has been finished.
Successfully imported: 
Imported P1302959.JPG as P2013264 [edit].

The node is created, but no image is displayed. When I go to edit the node, the path to the image is blank.

The funny thing is, I was successfully using Import Image to upload images a week ago, and now I can't. I tried to import a few hundred images, and they all failed in this way.

Any help would be appreciated.

salvis’s picture

FWIW, I'm seeing the same error with img_assist...

The message is from file_copy().

salvis’s picture

Hobbes-2’s picture

subscribe

luf’s picture

Windows 2008 Server + IIS7 Users who receive this error:

I receieved this error plenty of times when trying to upload files or use ImageCache module to create thumbnails which showed up as red X's instead of pictures.

Go to your drupal site > Site Configuration > File System >
Your Temporary Path might be: C:\Windows\temp or something similar
If you receive the "file could not be copied" error, it is likely your permissions are not allowing a write to that file.

* TO FIX THIS ERROR *
1. Create a 'temp' folder in your drupal/sites/default/files/ directory
[edit- this was a 1. also lol]2. Change your Site Configuration > File System > Temporary Directory to: C:\inetpub\wwwroot\YOURSITE\sites\default\files\temp
3. Done.

If you do not use Windows Server 2008, IIS7, or do not have direct dedicated remote acces, you may be able to replace Step 1: C:\inetpub\wwwroot\etc etc.. with: sites\default\files\temp or any other writable folder source.

Enjoy.

jordan.schmitt’s picture

Thanks for the assist. Luf's solution above worked like a champ for me.

phpaddict’s picture

^^+1 It works for me as well. Thanks Luf.

phpaddict’s picture

Luf, if you don't mind me asking, why is that happen? Is it because image module has no access right over windows' temp directory?

celestialkiddy’s picture

Maybe you will be able to help since your setup is similar to mine, and we had the same probelm.

I finally got my image to upload following the steps above without any errors, and it is in the folder it should be after uploading - C:\inetpub\wwwroot\YOURSITE\sites\default\files\pictures

but I'm still getting just a red X for a picture...

nevermind I found a fix elsewhere!

What I needed to do was go to admin/settings/file-system and set the download method to private

Jsan2020’s picture

Thanks luf, your fix worked for me too.

salvis’s picture

@luv: Please don't falsify history by editing your old comments. Append a new comment instead.

All third-party comments after #18 are now obsolete because you changed your #18 (timestamp!), and we don't know what it was that they said was working for them.

luf’s picture

i changed a number from 1 to 2, it was reading steps: 1. 1. 3. :P