When uploading a new audio node, the following error is generated:

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

It seems to occur only upon the insert of the node. Upon investigation, I discovered that it is generated in the audio_images.module. I replaced _audio_images_save_new() function with the following:

function _audio_images_save_new(&$node, $image) {
  if (!$image['file_path']) {
    return;
  }
  $temppath = $image['filepath'];
  _audio_images_save_copy($node, $image);
  file_delete($temppath);
}

The only modification I made is that I added:

if (!$image['file_path']) {
  return;
}

It seems like the audio_images contains data even without a picture being attached to the audio node.

["audio_images"]=>
  array(1) {
    ["new"]=>

    array(1) {
      ["pictype"]=>
      int(3)
    }
  }

I don't know why. I haven't investigated it more. But, my coded fixes any errors.

Comments

drewish’s picture

Status: Needs review » Needs work

could you post a proper patch? http://drupal.org/patch

Michael M’s picture

Status: Needs work » Needs review
StatusFileSize
new393 bytes

Here you go...

wedge’s picture

I ran into this problem as well. The patch took care of it. Thanks!

drewish’s picture

Status: Needs review » Fixed

i've committed this to the 5 branch

vm’s picture

Status: Fixed » Active

does not look to me like the patch made it into the 5.x-dev. I just added the patch myself manually and its now working as expected.

Setting this to active to get drewish to reinspect.

vm’s picture

Status: Active » Reviewed & tested by the community

changed status to something more indicitive of the nature of the problem.

srodriguez’s picture

if (!$image['file_path']) {
return;
}

I found that with the code as is, it doesn't allow for images to be uploaded and attached to the node it needs to have the underscore removed then it works perfectly.

if (!$image['filepath']) {
return;
}

Michael M’s picture

Ah, sorry about that. That was a typo on my part. But, the patch contains the correct code.

dingbats’s picture

Status: Reviewed & tested by the community » Needs review
StatusFileSize
new0 bytes

The image upload field only appears after the audio node has been submitted, and then subsequently edited...why is this? I suggest putting the form element in the "insert" operation. And, also checking for the existence of the $image['filepath'] just in case. Here is another patch to do just that.

drewish’s picture

Status: Needs review » Needs work

i can't open the patch you attached.

dingbats’s picture

Status: Needs work » Needs review
StatusFileSize
new0 bytes

Hmm. Don't know what happened to the previous patch. So this is a fresh diff.

dingbats’s picture

StatusFileSize
new1011 bytes

Okay, I think I previewing a followup before submitting makes the upload empty. Anyway here is the patch.

drewish’s picture

Status: Needs review » Fixed
StatusFileSize
new957 bytes

marked http://drupal.org/node/142408 as a duplicate.

dingbats, sorry to have ignored this for so long. i made a few changes and i've attached a patch. i'm going to apply it to HEAD and DRUPAL-5

drewish’s picture

StatusFileSize
new1.55 KB

i don't think the last patch did the trick. i think we need to remove the empty image during the submit step. hook_audio() doesn't offer this as an operation so i'll have to add that.

i'm committing the attached to HEAD and DRUPAL-5

Anonymous’s picture

Status: Fixed » Closed (fixed)