public class UploadItemFile extends UploadItem
Use this when what you're uploading is a file.
| Constructor and Description |
|---|
UploadItemFile(File file)
Constructs a file upload specification.
|
UploadItemFile(File file,
String hintFilename)
Constructs a file upload specification.
|
UploadItemFile(File file,
String hintFilename,
String mimeType)
Constructs a file upload specification.
|
| Modifier and Type | Method and Description |
|---|---|
File |
getFile()
Gets the file to upload or
null if what is being uploaded
is not a physical file. |
protected InputStream |
getInputStream() |
long |
getSizeInBytes()
Gets the byte size of the upload item or -1 if the size is unknown.
|
getFormFieldName, getHintFilename, getMimeType, setFormFieldNamepublic UploadItemFile(File file, String hintFilename, String mimeType)
file - file to upload.hintFilename - hint given to the server about what filename to use
for the file.mimeType - MIME type for the file, e.g.
"application/zip". See
Wikipedia
for more information. If argument is null then the MIME type will be
guessed from file argument using URLConnection#guessContentTypeFromName()
and if this fails then DEFAULT_MIME_TYPE will
be used.public UploadItemFile(File file)
hintFilename will be derived from
file argument.
mimeType will be guessed from
file argument using URLConnection#guessContentTypeFromName()
and if this fails then DEFAULT_MIME_TYPE will
be used.
file - file to upload.public UploadItemFile(File file, String hintFilename)
hintFilename will be derived from
file argument.
mimeType will be guessed from file argument
using URLConnection#guessContentTypeFromName()
and if this fails then DEFAULT_MIME_TYPE will
be used.
file - file to upload.hintFilename - hint given to the server about what filename to use
for the file.public File getFile()
UploadItemnull if what is being uploaded
is not a physical file.getFile in class UploadItemprotected InputStream getInputStream() throws FileNotFoundException
getInputStream in class UploadItemFileNotFoundExceptionpublic long getSizeInBytes()
UploadItemgetSizeInBytes in class UploadItemCopyright © 2019 Addicticks. All rights reserved.