DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG 
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7120>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND 
INSERTED IN THE BUG DATABASE.

http://nagoya.apache.org/bugzilla/show_bug.cgi?id=7120

File obtained from the FormFile interface differs from original file to upload. 

           Summary: File obtained from the FormFile interface differs from
                    original file to upload.
           Product: Struts
           Version: 1.0.2 Final
          Platform: PC
               URL: No URL available, development on private company project
        OS/Version: Windows NT/2K
            Status: NEW
          Severity: Normal
          Priority: Other
         Component: File Upload
        AssignedTo: [EMAIL PROTECTED]
        ReportedBy: [EMAIL PROTECTED]


The size given was higher by one byte as compared to the original file.

This reaction seems to happen under only some rare file conditions. The file I 
use is a binary data file. Somewhere in the file, there is a sequence of data 
that is the equivalent of the ASCII values of <CR> <LF> <LF>. For a reason that 
escapes me, where I read the file through an input stream, the values <CR> <LF> 
<CR> <LF> are read in that data segment. An extra byte seems to have 
spontaneously generated itself in the data, corrupting the file. 

I have played with the file, testing the upload after having reduced its size 
and added extra garbage. I even made a 3 byte file with that sequence of 
characters, yet the problem persisted. As I ended up with a 4 byte file as I 
uploaded it to the server using the struts.

<Here is the segment of code causing the problem>

On a JSP page containing the following: 

<html:form name="engineFileUploadForm" action="/loadEngineFileToDB.do"
           enctype="multipart/form-data" 
type="com.pwc.webectm.formbean.EngineFileUploadForm">

...

<html:file property="theFile" styleClass="textbox"/>

...

And the EngineUploadAction.java containing the following:

public ActionForward perform(ActionMapping mapping, ActionForm form, 
HttpServletRequest request, HttpServletResponse response) throws IOException, 
ServletException {
    if (form instanceof EngineFileUploadForm) {
      EngineFileUploadForm uploadForm = (EngineFileUploadForm)form;

...

FormFile file = uploadForm.getTheFile();
int size = file.getFileSize(); 

...

--
To unsubscribe, e-mail:   <mailto:[EMAIL PROTECTED]>
For additional commands, e-mail: <mailto:[EMAIL PROTECTED]>

Reply via email to