Saving nodes with a filefield

后端 未结 3 2055
一向
一向 2021-01-15 01:38

I\'m in the progress of creating a bulk upload function for a Drupal site. Using flash I\'m able to upload the files to a specific url that then handles the files. What I wa

3条回答
  •  生来不讨喜
    2021-01-15 02:03

    I have done something whith imagefield which worked, I think the structure has to be right otherwise it won't work. It took a lot of trial and error. This is is what I populated the imagefield with.

    $image['data'] =array(
                'title' => $media_reference_attributes->getNamedItem("source")->value,
                'description' => $description,
                'alt' => "",);
    $image['width'] = $width;
    $image['height'] = $height;
    $image['mimetype'] = $mime_type
    $image['uid'] = 1;
    $image['status'] = 1;
    $image['fid'] = $fid;
    $image['filesize'] = $file->filesize;
    $image['nid'] = $id;
    $image['filename'] = $url;
    $image['timestamp'] = $file->timestamp;
    $image['filepath'] = $file_path;
    

    Hope this is of some help.

提交回复
热议问题