public interface UploadToStreamCmd extends ControllerCommand
UploadToStreamCmd
will upload the file to an InputStream
.
Note that this is not registered in
URL
configuration. UploadToStreamCmd
is not
intended to be used directly. It should be extended by other commands.
It will return an InputStream
. Any command that uses
UploadToStreamCmd
can convert
the InputStream
to whatever format is necessary.
This is not recommended for uploading a very large file, there may be performance issues.
If the uploaded file is a JAR
or ZIP
file the system will not verify whether
the JAR
or ZIP
contains unsupported file types or extensions.
There is no access control management used with this command. If your command extends from UploadToStreamCmd, you should implement your own access control checking.
In addition, if your command extends from UploadToStreamCmd, it is required to set up the attachment configuration section in the instance file. For example:
<Attachment display="false"
maxuploadsize="100000000">
<Command maxuploadsize="1000000"
name="MyUploadCmd"
supportedFileExtension="gif,jpg"
uploadReturnURL_enabled="false"
viruscheck="no" />
</Attachment>
name = MyUploadCmd
: This is the command name that extends TempUploadCmd
.
This must be the command name that is retrieved from the command context.maxuploadsize
: This is the maximum allowable upload size for MyUploadCmd
.
This must be less than the site maxuploadsize
.supportedFileExtension
: This is the file extension that is allowed to be uploaded.uploadReturnURL_enabled
: This indicates whether to return to the URL
when
the command is completed. The command writers' own commands should set response properties and handle
the returns according to their requirements.virusCheck
: This indicates whether virusCheck
should be enabled.
Virus checking is not provided by default.This class returns the input stream used to upload the file (inputstream
).
Modifier and Type | Field and Description |
---|---|
static java.lang.String |
COPYRIGHT
IBM copyright notice field.
|
static java.lang.String |
defaultCommandClassName
This is the default class.
|
Modifier and Type | Method and Description |
---|---|
long |
getAttachmentOwner()
This method gets the
owner_id of the creator of the uploaded attachment. |
java.io.InputStream |
getAttachmentStream()
This method gets the attachment stream from when the upload is completed.
|
java.lang.String |
getFileName()
This method gets the
filename of the uploaded file. |
long |
getFileSize()
This method gets the
filesize of the uploaded file. |
java.lang.String |
getUrl()
This method gets the return
URL when the upload is completed. |
checkPermission, execute, getGeneric, getRequestProperties, getResolvedRequestProperties, getResponseProperties, getRetriable, getViewInputProperties, isGeneric, isRetriable, mergeProperties, setGeneric, setRequestProperties, setRetriable, setViewInputProperties
executeFromCache, getCaller, getEntryInfo, getId, getSharingPolicy, postExecute, preExecute, setCaller, updateCache
getCommandTarget, getCommandTargetName, hasOutputProperties, performExecute, setCommandTarget, setCommandTargetName, setOutputProperties
accessControlCheck, getAccCheck, getForUserId, getResourceOwners, setAccCheck, setForUserId, setOwner
checkIsAllowed, checkResourcePermission, createCommandExecutionEvent, getCommandContext, getCommandIfName, getCommandName, getCommandStoreId, getDefaultProperties, getExceptionInvokeParameters, getPostInvokeParameters, getPreInvokeParameters, getResources, getStoreId, getUser, getUserId, performExecute, setCommandContext, setCommandIfName, setCommandStoreId, setDefaultProperties, validateParameters
fulfills, getOwner
static final java.lang.String COPYRIGHT
static final java.lang.String defaultCommandClassName
java.lang.String getUrl()
URL
when the upload is completed.URL
of when the upload is completed.java.io.InputStream getAttachmentStream()
InputStream
object that represents the attachment upload stream.long getAttachmentOwner()
owner_id
of the creator of the uploaded attachment.
The owner is the one who logs into the store and performs the command.owner_id
of the person who uploads the attachment.long getFileSize()
filesize
of the uploaded file.filesize
of the uploaded file.java.lang.String getFileName()
filename
of the uploaded file.filename
of the uploaded file.