public class MultipartUploadRequest extends HttpUploadRequest<MultipartUploadRequest>
Constructor and Description |
---|
MultipartUploadRequest(Context context,
String serverUrl)
Creates a new multipart upload request and automatically generates an upload id, that will
be returned when you call
UploadRequest.startUpload() . |
MultipartUploadRequest(Context context,
String uploadId,
String serverUrl)
Creates a new multipart upload request.
|
Modifier and Type | Method and Description |
---|---|
MultipartUploadRequest |
addFileToUpload(String path,
String parameterName)
Adds a file to this upload request, without setting file name and content type.
|
MultipartUploadRequest |
addFileToUpload(String path,
String parameterName,
String fileName)
Adds a file to this upload request, without setting the content type, which will be
automatically detected from the file extension.
|
MultipartUploadRequest |
addFileToUpload(String filePath,
String parameterName,
String fileName,
String contentType)
Adds a file to this upload request.
|
MultipartUploadRequest |
setUtf8Charset()
Sets the charset for this multipart request to UTF-8.
|
addArrayParameter, addArrayParameter, addHeader, addParameter, setBasicAuth, setCustomUserAgent, setMethod, setUsesFixedLengthStreamingMode
setAutoDeleteFilesAfterSuccessfulUpload, setDelegate, setMaxRetries, setNotificationConfig, startUpload
public MultipartUploadRequest(Context context, String uploadId, String serverUrl) throws IllegalArgumentException, MalformedURLException
context
- application contextuploadId
- unique ID to assign to this upload request.UploadServiceBroadcastReceiver
,
you know to which upload they refer to.serverUrl
- URL of the server side script that will handle the multipart form upload.
E.g.: http://www.yourcompany.com/your/scriptIllegalArgumentException
- if one or more arguments are not validMalformedURLException
- if the server URL is not validpublic MultipartUploadRequest(Context context, String serverUrl) throws MalformedURLException, IllegalArgumentException
UploadRequest.startUpload()
.context
- application contextserverUrl
- URL of the server side script that will handle the multipart form upload.
E.g.: http://www.yourcompany.com/your/scriptIllegalArgumentException
- if one or more arguments are not validMalformedURLException
- if the server URL is not validpublic MultipartUploadRequest addFileToUpload(String filePath, String parameterName, String fileName, String contentType) throws FileNotFoundException, IllegalArgumentException
filePath
- path to the file that you want to uploadparameterName
- Name of the form parameter that will contain file's datafileName
- File name seen by the server side script. If null, the original file name
will be usedcontentType
- Content type of the file. You can use constants defined in
ContentType
class. Set this to null or empty string to try to
automatically detect the mime type from the file. If the mime type can't
be detected, application/octet-stream
will be used by defaultMultipartUploadRequest
FileNotFoundException
- if the file does not exist at the specified pathIllegalArgumentException
- if one or more parameters are not validpublic MultipartUploadRequest addFileToUpload(String path, String parameterName, String fileName) throws FileNotFoundException, IllegalArgumentException
addFileToUpload(String, String, String, String)
.path
- Absolute path to the file that you want to uploadparameterName
- Name of the form parameter that will contain file's datafileName
- File name seen by the server side script. If null, the original file name
will be usedMultipartUploadRequest
FileNotFoundException
- if the file does not exist at the specified pathIllegalArgumentException
- if one or more parameters are not validpublic MultipartUploadRequest addFileToUpload(String path, String parameterName) throws FileNotFoundException, IllegalArgumentException
addFileToUpload(String, String, String, String)
path
- Absolute path to the file that you want to uploadparameterName
- Name of the form parameter that will contain file's dataMultipartUploadRequest
FileNotFoundException
- if the file does not exist at the specified pathIllegalArgumentException
- if one or more parameters are not validpublic MultipartUploadRequest setUtf8Charset()