Skip to content

Using FileID to set filesystem path #842

@chrschae

Description

@chrschae

Hello,
Im wondering if this package supports subdirectories -
I would like to have a structure like

project_files / projectID / file1
project_files / projectID / file2

I managed to save the files by calling the write function on the server like

const _addFileMeta = {
fileName: filename,
type: mimeType,
fileId: "project_documents/48979DF2-7214-EC11-8EB6-00155D647A28" + path.parse(filename).name,
meta: {
type : FILE_TYPE_PROJECT,
crmId : "48979DF2-7214-EC11-8EB6-00155D647A28",
userId: user._id
}
};
Files.write(buffer, _addFileMeta, function (_uploadError, _uploadData) {
....

The problem with this approach is that the .link() method seems to be broken now -
i get a link back like
http://localhost:3000/cdn/storage/files/project_documents/48979DF2-7214-EC11-8EB6-00155D647A28/test-img3/original/project_documents/48979DF2-7214-EC11-8EB6-00155D647A28/test-img3.jpg?download=true

The file on the filesystem got saved like it should, only problem i have is the link not working now - i guess this isnt supported? Maybe there is another way to achieve a subdirectory structure?

Thanks in advance!

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions