struts-user mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Tommy Pham <tommy...@yahoo.com>
Subject Re: problem uploading a text file
Date Fri, 04 Sep 2009 22:33:16 GMT
----- Original Message ----
> From: Bill Bohnenberger <bill98122@gmail.com>
> To: Struts Users Mailing List <user@struts.apache.org>
> Sent: Friday, September 4, 2009 2:50:47 PM
> Subject: Re: problem uploading a text file
> 
> Well, I am the one who is confused, for sure. I restarted eclipse and now I
> can upload *.txt files just fine with my original xml:
> 
>   
> method="{1}">
>         bulkUpload.jsp
>         Menu_init
>         Login_init
>     
> 
> Arrg, this is not the first time Eclipse has refused to work properly in
> "hosted" mode until I restarted it. But this time I totally forgot to try
> that tactic :(  Sorry for the bother!
> 
> Bill
> 

I've noticed the similar problem with Eclipse 3.5 (Build id: 20090619-0625).  It doesn't seem
to (automatically) synchronize properly as it did with 3.4.2.  My development time gone up
because I have to manually redeploy and/or restart the server more often.

Regards,
Tommy

> On Fri, Sep 4, 2009 at 1:41 PM, Chris Pratt wrote:
> 
> > I guess I don't understand why the interceptor would care what the content
> > of the file is.  It's only job is to inject the parameters into the action.
> >  (*Chris*)
> >
> > On Fri, Sep 4, 2009 at 1:24 PM, Bill Bohnenberger 
> > >wrote:
> >
> > > Thanks, Chris, but I don't think that's the problem. I have another jsp
> > > page
> > > and associated action that uploads .jpg and .gif images ok with the same
> > > variables...the only difference is that I am tying to get the fileUpload
> > > interceptor to accept a *.txt file. (Sorry, I should've mentioned all
> > this
> > > in my original post)
> > >
> > > Bill
> > >
> > > On Fri, Sep 4, 2009 at 12:36 PM, Chris Pratt 
> > > >wrote:
> > >
> > > > I believe the documentation is incorrect on the web.  The setUpload
> > > doesn't
> > > > take a File object, it takes a String that is the fully qualified path
> > to
> > > > the temporary file created by the internal upload support of struts.
> >  So
> > > > what you actually need is:
> > > >
> > > >   public void setUpload(String upload)
> > > >   {
> > > >       this.upload = new File(upload);
> > > >   }
> > > >
> > > > (*Chris*)
> > > >
> > > > On Fri, Sep 4, 2009 at 11:40 AM, Bill Bohnenberger <
> > bill98122@gmail.com
> > > > >wrote:
> > > >
> > > > > Ok, I'm sure I must be doing something dumb here, but I can't seem
to
> > > > find
> > > > > it. I'm have a problem uploading a simple text file... when I try
to
> > a
> > > > file
> > > > > named "test.txt", I get an action error message "File upload error:
> > > > invalid
> > > > > data." and all my file variables (see below) are null when the action
> > > > > method
> > > > > gets called.
> > > > >
> > > > > Here's my setup:
> > > > >
> > > > > Config:
> > > > >
> > > > >    
> > > > > method="{1}">
> > > > >        
> > > > >        
> > > > >            8192000
> > > > >            
> > > > > name="allowedTypes">image/jpeg,image/gif,text/plain
> > > > >        
> > > > >        
> > > > >        
> > > > >
> > > > >        bulkUpload.jsp
> > > > >        Menu_init
> > > > >        Login_init
> > > > >    
> > > > >
> > > > > Relevant jsp code:
> > > > >
> > > > > 
> > > > > enctype="multipart/form-data">
> > > > >    
> > > > >    
> > > > >    
> > > > > 
> > > > >
> > > > > Action excerpts:
> > > > > ...
> > > > >    private String uploadContentType;
> > > > >    private String uploadFileName;
> > > > >    private File upload;
> > > > > ...
> > > > >    public void setUpload(File upload)
> > > > >    {
> > > > >        this.upload = upload;
> > > > >    }
> > > > >    public void setUploadFileName(String uploadFileName)
> > > > >    {
> > > > >        this.uploadFileName = uploadFileName;
> > > > >    }
> > > > >    public void setUploadContentType(String uploadContentType)
> > > > >    {
> > > > >        this.uploadContentType = uploadContentType;
> > > > >    }
> > > > >
> > > > > As I mentioned above, when I use this form to upload a text file
> > named
> > > > > "test.txt" I get the action error message "File upload error: invalid
> > > > > data."
> > > > > and all my "upload..." variables are null.
> > > > >
> > > > > Thanks,
> > > > > Bill
> > > > >
> > > >
> > >
> >


---------------------------------------------------------------------
To unsubscribe, e-mail: user-unsubscribe@struts.apache.org
For additional commands, e-mail: user-help@struts.apache.org


Mime
View raw message