[ 
https://issues.apache.org/jira/browse/WW-4782?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Lukasz Lenart updated WW-4782:
------------------------------
    Description: 
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}

  was:
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 :
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', ]





> 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)

Reply via email to