You are viewing a plain text version of this content. The canonical link for it is here.
Posted to issues@struts.apache.org by "fairy (JIRA)" <ji...@apache.org> on 2017/04/13 15:08:41 UTC

[jira] [Commented] (WW-4782) Struts2.5.10.1 upload photo file can't set success

    [ https://issues.apache.org/jira/browse/WW-4782?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15967701#comment-15967701 ] 

fairy commented on WW-4782:
---------------------------

it has the error message as below...,next time i will send email.

ERROR ParametersInterceptor Developer Notification (set struts.devMode to false to disable this message):
Unexpected Exception caught setting 'uploadFileName' on 'class actions.UploadHeadPhotoAction: Error setting expression 'uploadFileName' with value ['tabletennis_head.jpg', ]
--------haaaaaaaaaa-----start---------------
C:\app\apache-tomcat-7.0.76-windows-x64\apache-tomcat-7.0.76\work\Catalina\localhost\Struts2-UploadPhoto-Demo\upload_467f0025_9cac_4b31_8a85_04b178fb525d_00000001.tmp
image/jpeg
null
--------haaaaaaaaaa------end--------------

> Struts2.5.10.1 upload photo file can't set success
> --------------------------------------------------
>
>                 Key: WW-4782
>                 URL: https://issues.apache.org/jira/browse/WW-4782
>             Project: Struts 2
>          Issue Type: Bug
>          Components: Core
>    Affects Versions: 2.5.10
>         Environment: Windows10 ,jdk1.7.80, struts2.5.10.1
>            Reporter: fairy
>              Labels: struts2.5.10.1, upload
>
> Hi ,today i found my application can't upload file success,Could you help me check it?
> I have do it follow the guide:
> http://struts.apache.org/docs/file-upload.html
> the error message as below :
> {noformat}
> Unexpected Exception caught setting 'upload' on 'class com.opensymphony.xwork2.ActionSupport: Error setting expression 'upload' with value ['org.apache.struts2.dispatcher.multipart.StrutsUploadedFile@22261709', ]
> ERROR ParametersInterceptor Developer Notification (set struts.devMode to false to disable this message):
> Unexpected Exception caught setting 'uploadContentType' on 'class com.opensymphony.xwork2.ActionSupport: Error setting expression 'uploadContentType' with value ['image/jpeg', ]
> ERROR ParametersInterceptor Developer Notification (set struts.devMode to false to disable this message):
> Unexpected Exception caught setting 'uploadFileName' on 'class com.opensymphony.xwork2.ActionSupport: Error setting expression 'uploadFileName' with value ['tabletennis_head.jpg', ]
> {noformat}
> index.jsp
> {code:xml}
> <div class="row">
> 		<div class="col-md-12">
> 			<s:actionerror cssClass="alert alert-error" />
> 			<s:fielderror cssClass="alert alert-error" />
> 			<s:form action="appUploadHeadPhotoAction.do"
> 				method="POST" enctype="multipart/form-data">
> 				<s:file name="upload" label="File" />
> 				<s:submit cssClass="btn btn-primary" />
> 			</s:form>
> 		</div>
> 	</div>
> {code}
> Action file:
> {code:java}
> 	private File upload;
> 	private String uploadContentType;
> 	private String uploadFilename;
> 	public File getUpload() {
> 		return upload;
> 	}
> 	public void setUpload(File upload) {
> 		this.upload = upload;
> 	}
> 	public String getUploadContentType() {
> 		return uploadContentType;
> 	}
> 	public void setUploadContentType(String uploadContentType) {
> 		this.uploadContentType = uploadContentType;
> 	}
> 	public String getUploadFilename() {
> 		return uploadFilename;
> 	}
> 	public void setUploadFilename(String uploadFilename) {
> 		this.uploadFilename = uploadFilename;
> 	}
> 	public String execute() {
> 		System.out.println("--------haaaaaaaaaa-----start---------------");
> 		System.out.println(upload);
> 		System.out.println(uploadContentType);
> 		System.out.println(uploadFilename);
> 		System.out.println("--------haaaaaaaaaa------end--------------");
> 		return SUCCESS;
> 	}
> {code}



--
This message was sent by Atlassian JIRA
(v6.3.15#6346)