uploadFile
Upload a file to the configurator session
Signatures
- Paramate.Configurator.uploadFile(options)
Details
The function uploads a file for use in the configurator. It does not set the value of a parameter so the file will not be used yet. The options should be in a javascript object.
Example
configurator.uploadFile({
file: document.getElementById('fileInput').files[0],
fileId: 'main:file',
progress: function(progress){console.log(progress.loaded / progress.total);},
success: function(res){console.log(res.token);}
});
Note
To use the file in the configurator, after the upload a file parameter's value has to be set to the token in the response of the request.
Parameters
- file
-
HTML file object.
- fileId
-
The ID to upload the file to. Please note that even if this is the same as the name of an open parameter, just uploading the file does not change the value of the open parameter.
- progress
-
Progress event handler function. It gets a progress event object (event.loaded, event.total)
- success
-
Success callback function with the response (same object as the return value)
Return value
The response of the request:
{
token: ... // string: the file ID
}
this token can be used as a value for a file open parameter.