How can I change the upload file/folder path?
By default, files are uploaded to the following folder path:
/uploads/{UTC_YEAR}/{UTC_MONTH}/{UTC_DAY}
With the following file name:
{UTC_TIME_TOKEN_INVERSE}{UNIQUE_DIGITS_2}-{ORIGINAL_FILE_NAME}{ORIGINAL_FILE_EXT}
For example:
/uploads/2024/05/20/4kcDPp6sF2-example.jpg
This file path convention allows you to filter your files by year/month/day, and also provides a natural time descending order to your file names (so that new files appear first when listing them).
The {UNIQUE_DIGITS_2}
part helps to prevent collisions. If you attempt to upload to an existing file path, a permissions error will occur unless your API key is authorized to overwrite files. Public API keys do not have overwrite permissions, except when allowed by a valid JWT.
For more information on codes like
{UTC_YEAR}
, please see: Path Variables.
How to change the default file/folder path:
To change the path your files are uploaded to by default:
- Sign in to the Bytescale Dashboard.
- Navigate to the Security page.
- Click "Edit" on the API key you're using.
- Click "File Upload Path" on the API key's configuration page.
- Edit the Folder and/or File Path.
- Click "Save Changes"
How to override the file/folder path during upload:
If you want to specify the file or folder path during upload, pass the fileName
and/or folderPath
parameters to the Bytescale API/SDK/Upload Widget:
Bytescale Upload Widget
Refer to the Bytescale Upload Widget docs.
Bytescale JavaScript SDK
Refer to the Bytescale JavaScript SDK docs.
Bytescale REST API
For users interacting directly with our REST APIs, please read one of the following:
- The BasicUpload API endpoint docs.
- The FormDataUpload API endpoint docs.
Tip: Search for the
fileName
andfolderPath
parameters in the above documentation.