saveFileToUserUploads()

This function is used to save a file from the user to the folder named user-uploads.

Example

import { createBackendFunction, createRequestContext, useFunctionContext, utils } from '@magicjs.dev/backend';

export default createBackendFunction(async function () {
  createRequestContext(this)
    .uploader()
    .onFile((info, file) => {
      // Will get the file information from the parameter info.
      utils.saveFileToUserUploads('/', 'imageName.jpeg', file);
    });
})

An example of the usage is given in the createUploader section.

Click here to refer GitHub.

Last updated