public class UploadedFile extends Object
Files are uploaded via the REST API by POSTing multipart/form-data
to a resource method
which consumes multipart/form-data
and has UploadedFile as its entity parameter.
Client-side support: the public API of the Files plugin provides a method
dm4c.get_plugin("systems.dmx.files").open_upload_dialog()
that allows the user to
choose and upload a file.
Modifier and Type | Field and Description |
---|---|
private DiskQuotaCheck |
diskQuotaCheck |
private org.apache.commons.fileupload.FileItem |
fileItem |
Constructor and Description |
---|
UploadedFile(org.apache.commons.fileupload.FileItem fileItem,
DiskQuotaCheck diskQuotaCheck) |
Modifier and Type | Method and Description |
---|---|
byte[] |
getBytes()
Returns the contents of the uploaded file as an array of bytes.
|
InputStream |
getInputStream()
Returns an InputStream that can be used to retrieve the contents of the uploaded file.
|
String |
getMediaType()
Returns the content type passed by the browser or
null if not defined. |
String |
getName()
Returns the original filename in the client's filesystem, as provided by the browser (or other client software).
|
long |
getSize()
Returns the size of the file.
|
String |
getString()
Returns the contents of the uploaded file as a String, using the default character encoding.
|
String |
getString(String encoding)
Returns the contents of the uploaded file as a String, using the specified encoding.
|
String |
toString() |
void |
write(File file)
A convenience method to write the uploaded file to disk.
|
private org.apache.commons.fileupload.FileItem fileItem
private DiskQuotaCheck diskQuotaCheck
public UploadedFile(org.apache.commons.fileupload.FileItem fileItem, DiskQuotaCheck diskQuotaCheck)
public String getName()
public long getSize()
public String getMediaType()
null
if not defined.public String getString()
public String getString(String encoding)
public byte[] getBytes()
public InputStream getInputStream()
Copyright © 2018. All Rights Reserved.