public class FileUploadPluginApi extends PluginApi<FileUploadPlugin>
FileItem
s. This is the wrapper accessible from in-document scripts.Constructor and Description |
---|
FileUploadPluginApi(FileUploadPlugin plugin,
XWikiContext context)
API constructor.
|
Modifier and Type | Method and Description |
---|---|
void |
cleanFileList()
Deletes all temporary files of the upload.
|
String |
getFileItem(String formfieldName)
Deprecated.
not well named, use
getFileItemAsString(String) |
String |
getFileItemAsString(String formfieldName)
Allows to retrieve the contents of an uploaded file as a string.
|
byte[] |
getFileItemData(String formfieldName)
Allows to retrieve the contents of an uploaded file as a sequence of bytes.
|
List<String> |
getFileItemNames()
Retrieves the list of FileItem names.
|
List<org.apache.commons.fileupload.FileItem> |
getFileItems()
Allows to retrieve the current list of uploaded files, as a list of
FileItem s. |
String |
getFileName(String formfieldName)
This method returns the name of the first matching file with the formfieldName.
|
void |
loadFileList()
Loads the list of uploaded files in the context if there are any uploaded files.
|
void |
loadFileList(long uploadMaxSize,
int uploadSizeThreashold,
String tempdir)
Loads the list of uploaded files in the context if there are any uploaded files.
|
getInternalPlugin, getProtectedPlugin, setPlugin
convert, convert, convert, convertAttachments, getAuthorizationManager, getContextualAuthorizationManager, getXWikiContext, hasAccess, hasAccessLevel, hasAdminRights, hasProgrammingRights, hasWikiAdminRights
public FileUploadPluginApi(FileUploadPlugin plugin, XWikiContext context)
plugin
- The wrapped plugin object.context
- Context of the request.PluginApi(com.xpn.xwiki.plugin.XWikiPluginInterface, XWikiContext)
public void cleanFileList()
public void loadFileList() throws XWikiException
XWikiException
- if the request could not be parsed, or the maximum file size was reached.public void loadFileList(long uploadMaxSize, int uploadSizeThreashold, String tempdir) throws XWikiException
uploadMaxSize
- Maximum size of the uploaded files.uploadSizeThreashold
- Threashold over which the file data should be stored on disk, and not in memory.tempdir
- Temporary directory to store the uploaded files that are not kept in memory.XWikiException
- if the request could not be parsed, or the maximum file size was reached.public List<org.apache.commons.fileupload.FileItem> getFileItems()
FileItem
s. loadFileList()
needs to be called beforehandpublic byte[] getFileItemData(String formfieldName) throws XWikiException
loadFileList()
needs to be
called beforehand. This method returns the contents of the first matching FileItem with the formfieldName. If you
are dealing with multiple files with the same formfieldName you should use getFileItems()
formfieldName
- The name of the form field.XWikiException
- if the data could not be read.@Deprecated public String getFileItem(String formfieldName) throws XWikiException
getFileItemAsString(String)
loadFileList()
needs to be called
beforehand. This method returns the contents of the first matching FileItem with the formfieldName. If you are
dealing with multiple files with the same form field name you should use getFileItems()
formfieldName
- The name of the form field.XWikiException
- Exception is thrown if the data could not be read.public String getFileItemAsString(String formfieldName) throws XWikiException
loadFileList()
needs to be called
beforehand. This method returns the contents of the first matching FileItem with the formfieldName. If you are
dealing with multiple files with the same form field name you should use getFileItems()
formfieldName
- The name of the form field.XWikiException
- if the data could not be read.public List<String> getFileItemNames()
loadFileList()
needs to be called beforehand.public String getFileName(String formfieldName)
getFileItemNames()
formfieldName
- The name of the form field.Copyright © 2004–2022 XWiki. All rights reserved.