@Component @Named(value="upload") @Singleton public class UploadAction extends XWikiAction
filepath
.ACTION_PROGRESS, componentDescriptor, container, execution, handleRedirectObject, observation, waitForXWikiInitialization
Constructor and Description |
---|
UploadAction() |
Modifier and Type | Method and Description |
---|---|
boolean |
action(XWikiContext context) |
protected String |
getFileName(String fieldName,
FileUploadPlugin fileupload,
XWikiContext context)
Extract the corresponding attachment name for a given file field.
|
String |
render(XWikiContext context) |
boolean |
uploadAttachment(String fieldName,
String filename,
FileUploadPlugin fileupload,
XWikiDocument doc,
XWikiContext context)
Attach a file to the current document.
|
answerJSON, cleanupComponents, csrfTokenCheck, csrfTokenCheck, execute, execute, getContextualAuthorizationManager, getCurrentMixedDocumentReferenceResolver, getCurrentScriptContext, getEntityNameValidationConfiguration, getEntityNameValidationManager, getFormClass, getLocalization, getLocalSerializer, getName, getProgress, getRealPath, getTranslatedDocument, handleRedirectObject, handleRevision, initializeContainerComponent, initializeXWikiContext, initializeXWikiContext, isEntityReferenceNameValid, localizePlainOrKey, readFromTemplate, resolveTemplate, sendGlobalRedirect, sendRedirect, setContentLength, writeAjaxErrorResponse
public boolean action(XWikiContext context) throws XWikiException
action
in class XWikiAction
XWikiException
public boolean uploadAttachment(String fieldName, String filename, FileUploadPlugin fileupload, XWikiDocument doc, XWikiContext context) throws XWikiException
fieldName
- the target file fieldfilename
- fileupload
- the FileUploadPlugin
holding the form datadoc
- the target documentcontext
- the current request contexttrue
if the file was successfully attached, false
otherwise.XWikiException
- if the form data cannot be accessed, or if the database operation failedprotected String getFileName(String fieldName, FileUploadPlugin fileupload, XWikiContext context) throws XWikiException
fieldName
- the target file fieldfileupload
- the FileUploadPlugin
holding the form datacontext
- the current request contextXWikiException
- if the form data cannot be accessed, or if the specified filename is invalidpublic String render(XWikiContext context) throws XWikiException
render
in class XWikiAction
XWikiException
Copyright © 2004–2021 XWiki. All rights reserved.