[development] Clone Node with File Attachments

Nedjo Rogers nedjo at islandnet.com
Wed Dec 12 23:17:22 UTC 2007


> HOWEVER,  when I click on the "submit" button and save the new node, the 
> file attachments do NOT appear.  Can someone tell me what I'm missing 
> here?

upload.module has the code you'll need to study--specifically, 
upload_nodeapi and upload_save.

Note that saving file associations is limited by a permission.

The key question to consider is, what does upload do with a *new* node? In 
this case, any files associated with a node are those that were just 
uploaded.

    // New file upload
    elseif (strpos($file->fid, 'upload') !== FALSE) {

This won't help you, as your files array doesn't contain this marker.

Consider instead:

elseif ($node->old_vid && is_numeric($fid)) {

You could consider tricking upload.module into doing the handling by setting 
an old_vid. Or else just write your own handling based on upload_save. 



More information about the development mailing list