To upload files via your command line or within your application, we suggest using CURL:

Guest uploads

First, create a session to obtain an "fuid" which will be used to identify further requests for a specific upload.
$ curl 'https://up.ufile.io/v1/upload/create_session' \
-d 'file_size=TOTAL_SIZE_OF_FILE'


On success, you will receive the "fuid" in a JSON response such as:
{"fuid":"857f63d5a91512b55e38270b12ae78e2"}

Copy the "fuid" and post it with each chunk of your file, until the entire file has been uploaded:
curl 'https://up.ufile.io/v1/upload/chunk' \
-F 'chunk_index=CURRENT_CHUNK_NUMBER' \
-F 'fuid=FUID_FROM_SESSION_REQUEST' \
-F 'file=@LOCATION_OF_CHUNK_TO_UPLOAD'


Once all chunks have been uploaded, you can finalise the upload like this:
curl 'https://up.ufile.io/v1/upload/finalise' \
-d 'fuid=FUID_FROM_SESSION_REQUEST' \
-d 'file_name=YOUR_FILENAME' \
-d 'file_type=YOUR_EXTENSION' \
-d 'total_chunks=TOTAL_CHUNK_COUNT'


On success, you will receive confirmation like this:
{"status":true,"id":1620449,"url":"https:\/\/ufile.io\/ewty4gfl","destination":"https:\/\/ufile.io\/ewty4gfl","name":"g48b2w9m-manta-3.mp4","filename":"ewty4gfl-g48b2w9m-manta-3.mp4","slug":"ewty4gfl","size":"32.2 MB","type":"video","expiry":"∞","location":10}

User uploads with api_key
To upload permanent files to your account you'll need an api_key, which is available on our Business plan, and can be found here

First, create a session to obtain an "fuid" which will be used to identify further requests for a specific upload.
$ curl 'https://up.ufile.io/v1/upload/create_session' \
-H "X-API-KEY: YOUR_API_KEY" \
-d 'file_size=TOTAL_SIZE_OF_FILE'


Then repeat steps 2 & 3 from above in "Guest uploads"
Was this article helpful?
Cancel
Thank you!