> For the complete documentation index, see [llms.txt](https://skyslit.gitbook.io/magicjs/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://skyslit.gitbook.io/magicjs/api-references/backend/utils/savefiletouseruploads.md).

# saveFileToUserUploads()

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

> Example

```tsx
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](https://skyslit.gitbook.io/magicjs/api-references/backend/utils/pages/MACOoHuRZxX4TbJvIrlp#backend-upload.server) section.

[Click here to refer GitHub.](https://github.com/skyslit/magicjs.dev/blob/main/packages/backend/src/utils.ts#L25)
