Apr 26, 2024 03:11 Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Parameters Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Returns Supported Clients Sample Parameters Returns Supported Clients SampleSupported Clients
SmartClient
WebClient
NGClient
Methods Summary
void
deleteFile()
Delets this uploaded file so it will be cleaned up if it was streamed in a temp file.
Array
getBytes()
This returns the bytes of the uploaded file, try to using streaming or file operation on it (so the bytes don't have to be full loaded in to memory)
String
getContentType()
String
getFieldValue(name)
Returns the value for a give form field that was give as metadata to this uploaded file
Array
getFields()
This returns the field names of the form fields that where give as metadata to this upload file.
String
getName()
Number
getSize()
String
getString()
Returns the contents of the file as as string in UTF-8 encoding.
Boolean
isInMemory()
If this returns false, then a tmp file is created for it.
Boolean
write(file)
Writes the contents of this upload right to a file.
Methods Details
deleteFile()
Delets this uploaded file so it will be cleaned up if it was streamed in a temp file.
The system tries to clean this up for you, but that can take a while and depends on Garbage Collection.
So it is better to be explicit and delete this file.
if you use JSUpload.write(file) then the file is very likely moved instead of copied so the temp file is also removed.
getBytes()
This returns the bytes of the uploaded file, try to using streaming or file operation on it (so the bytes don't have to be full loaded in to memory)
getContentType()
getFieldValue(name)
Returns the value for a give form field that was give as metadata to this uploaded file
String
name
The form fields name
getFields()
This returns the field names of the form fields that where give as metadata to this upload file.
getName()
getSize()
getString()
Returns the contents of the file as as string in UTF-8 encoding.
isInMemory()
If this returns false, then a tmp file is created for it. This means that you can also convert this to a JSFile and call rename() on it.
But the method write(file) will always work by writing the contents of this upload file to a different file.
write(file)
Writes the contents of this upload right to a file. Use the file plugin to create a JSFile object that can be given to this function.
If this file was not fully in memory (isInMemory == false) then this will just stream the tmp file to the give file.
If it was a temp file then it will try to move the file to the given location (so temp file is moved and because of that already deleted/cleaned up).
Object
file
the file object where to write to can be a JSFile or path string