I have enabled plupload. In one case it does not upload a file correctly, instead showing the error "The specified file could not be copied, because no file by that name exists. Please check that you supplied the correct filename."

To reproduce:
- Drupal 7.25
- Scald dev version
- Plupload module dev version with 1.5.8 library

1 - In the library sidebar, click the "Create a new image atom" icon
2 - Choose source=Image upload, and click continue
3 - In plupload click "add files". Select a single jpg file.
4 - Click continue
5 - Options window opens. No file present. Shows error message: "The specified file could not be copied, because no file by that name exists. Please check that you supplied the correct filename."

Note that after clicking continue in step 4, I see the % progress update from 0 to 100, and the icon change from red to green, so plupload is triggered to begin its automatic upload.

If I create an atom the non-modal way, starting from "Create Atom" under the navigation menu, there is no error and the file is uploaded correctly to the new atom.

If I create an atom the modal way, but after step 3 I click "Start upload" and let the upload complete before I click continue, this also works correctly without any error.

I see that DuneBL is having the same problem: https://drupal.org/node/2273619#comment-8810211

Any ideas where to look?

CommentFileSizeAuthor
#3 scald-plupload-2275349-3.patch937 bytesdavidhk
Support from Acquia helps fund testing for Drupal Acquia logo

Comments

davidhk’s picture

I've found the cause of the problem, but would welcome help with the best way to fix it.

If I use a single image provider (eg Scald Image), plupload works correctly. But once I enable a second image provider (eg Scald Flickr), I get the problem described above.

The problem is in dnd-modal.js, which makes two references to #edit-next. When using a single image provider, that is the ID for the 'Continue' button on the "Add" modal window.

Once we enable the second image provider, an extra window, "Source", is shown before the "Add" window. #edit-next, is now the ID for the 'Continue' button on the "Source" window. The Plupload doesn't appear til the "Add" window, where the Continue button's ID is now#edit-next--2. So the code in dnd-modal.js now runs on the wrong window's button, and we get the problem described.

Can anyone experienced with Javascript suggest a solution that works with both cases? A simple workaround is to duplicate the same code, once for #edit-next and once for #edit-next--2, but hopefully there is a neater way.

jcisio’s picture

I think we can simply replace $('#edit-next') by $('input[id^="edit-next"]).

davidhk’s picture

Status: Active » Needs review
FileSize
937 bytes

Thanks for the tip. The attached patch uses the suggested fix, and makes plupload work correctly whether there is one or multiple image providers enabled.

jcisio’s picture

Status: Needs review » Fixed

Because we are not sure the doctype is XHTML or HTML, I added quotes and committed. Thanks.

  • Commit 4cfc9ba on 7.x-1.x by jcisio:
    Issue #2275349 by davidhk: Fixed Plupload: 'The specified file could not...

Status: Fixed » Closed (fixed)

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