Description
Uploads a file to a specified location. No notifications are sent via this handler, please use file_send to send a notification following a successful upload.
URL
All responses are in JSON format by default, to specify an XML response add ".xml" to the end of the method name (in this case "file_upload")
https://<yoursubdomain>.filetransfers.net/api/file_upload
Restrictions
The calling user must have:
- Access to the file upload location.
- Upload permissions in the file upload location.
Parameters
Bold indicates required
Parameter | Description |
---|---|
path | Location where file will be uploaded. Specific paths can be retrieved from file_list. |
file | Post data of the file. |
overwrite | Default is 0, which will not overwrite a file with the same name in the same location and return an error if a file with same name is found. If value equals 1 any file with the same name will be overwritten with this file. |
comment | A comment about the file |
file_id_tag | A File ID tag for the file. |
api_key | Your API Key. |
timestamp | The current time in Unix timestamp format. |
signature | Please see "User Authentication" for more information. |
Sample Response
A successful response will include the newly uploaded file's ID, name, and size which can be passed to file_upload_notification if the user wishes to send an upload notification.
Successful response In JSON:
{"fileInfo":{"fileId":1071266,"path":"\/","fileName":"recording.aiff","fileSize":29117258}}
Successful response in XML:
<fileInfo> <fileId>1071267</fileId> <path>/</path> <fileName>image.png</fileName> <fileSize>315392</fileSize> </fileInfo>
Error response In JSON:
{"error":{"title":"File Cannot Be Overridden","message":"You have selected "overwrite" to be false and this file already exists in this location."}}
Error response In XML:
<error> <title>File Cannot Be Overridden</title> <message>You have selected "œoverwrite" to be false and this file already exists in this location.</message> </error>