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
Comment #1
drewish commentedcould you post a proper patch? http://drupal.org/patch
Comment #2
Michael M commentedHere you go...
Comment #3
wedge commentedI ran into this problem as well. The patch took care of it. Thanks!
Comment #4
drewish commentedi've committed this to the 5 branch
Comment #5
vm commenteddoes 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.
Comment #6
vm commentedchanged status to something more indicitive of the nature of the problem.
Comment #7
srodriguez commentedif (!$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;
}
Comment #8
Michael M commentedAh, sorry about that. That was a typo on my part. But, the patch contains the correct code.
Comment #9
dingbats commentedThe 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.
Comment #10
drewish commentedi can't open the patch you attached.
Comment #11
dingbats commentedHmm. Don't know what happened to the previous patch. So this is a fresh diff.
Comment #12
dingbats commentedOkay, I think I previewing a followup before submitting makes the upload empty. Anyway here is the patch.
Comment #13
drewish commentedmarked 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
Comment #14
drewish commentedi 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
Comment #15
(not verified) commented