ImportFile for Images always goes to root directory

I’m having trouble with
the following code for images:

const options = {

    displayName: fname,

    filePath: '/Media/Pictures',

    mediaType: mediatype,

    mimeType: mimetype,

    private: **false**

}

**try** {

    **const** importedFile = **await** files.importFile(fullurl, options);

    console.log("Imported file successfully:", importedFile);

    **return** importedFile;

} **catch** (error) {

    console.error(error);

    // Handle the error

}

if mediatype is “IMAGE”, the file is imported to the root directory, ignoring the filePath option. However if the mediatype is '“DOCUMENT”, it works fine… This behavior started recently. It was working correctly for images, but not now.

Any thoughts?

Thanks,

Rocky Altimore

Hi, @raltimore !!

I can’t say for certain since I haven’t used this SDK myself, but after checking the reference, it seems that you can specify a parentFolderId. So, I suggest finding out the folder ID first and then explicitly specifying it by ID. :innocent:

1 Like

Hi,

Thanks for the tip. That works… But it filePath should work as advertised… I do think there is a bug in the API…

Thanks Again