Big thanks Jason! You are right... I am reading each line and appending to the previous one without taking care of the linebreaks and had fully ignored this possibility. This solves it all for me. Thanks again, Rommel Sharma.
----- Original Message ----- From: "Jason Lea" <[EMAIL PROTECTED]> To: "Jakarta Commons Users List" <[EMAIL PROTECTED]> Sent: Thursday, July 29, 2004 2:36 PM Subject: Re: [Commons FileUpload]understanding the source code > You seem to missing the line terminators, the request sent would have > looked like this: > > -----------------------------7d433743032e > Content-Disposition: form-data; > name="file1"; > filename="C:\abc.txt" > Content-Type: text/plain > > XYZ > > -----------------------------7d433743032e-- > > > They just have to process each line. The blank line between > Content-type: and XYZ is important, that separates the headers from the > content. > > > Rommel Sharma wrote: > > >Hi, > > > >This question is about the Commons FileUpload package. I hope I am posting > >to the right users list. > > > >I am trying to understand the source code, and understand the logic through > >which the data is extracted. > > > >>From my understanding: when we use the file input tag to upload a file to > >the server using the POST method, then the data transferred looks like this: > > > >-----------------------------7d433743032eContent-Disposition: form-data; > >name="file1"; filename="C:\abc.txt"Content-Type: > >text/plainXYZ-----------------------------7d433743032e-- > > > >where the content in my file is XYZ. > > > >We can write a code that extracts the filename by parsing the inputstream. > >Now my question is that how can we extract the content XYZ as the > >Content-Type could be anything: text/plain, or text/html, or > >application/octet-stream or something else? We know that the content ends > >with the boundary (-----------------------------7d433743032e-- in this case > >in case of single file uplaod) so we know upto where the content will be, > >but how do we know the exact starting index of the content as the content > >type could vary. > > > >Also, the content length that I may extract, will give me size including > >that of the boundary and associated information also, but all I want is of > >only of the file uplaoded by the client. > > > >How did the Commons FileUpload team get across these problem? The source > >code, although very well written, looks a bit confusing to me. > > > >Thanks and Regards, > >Rommel Sharma. > > > > > > > > > >********************************************************* > >Disclaimer: > > > >This message (including any attachments) contains > >confidential information intended for a specific > >individual and purpose, and is protected by law. > >If you are not the intended recipient, you should > >delete this message and are hereby notified that > >any disclosure, copying, or distribution of this > >message, or the taking of any action based on it, > >is strictly prohibited. > > > >********************************************************* > >Visit us at http://www.mahindrabt.com > > > > > >--------------------------------------------------------------------- > >To unsubscribe, e-mail: [EMAIL PROTECTED] > >For additional commands, e-mail: [EMAIL PROTECTED] > > > > > > > > > > > -- > Jason Lea > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: [EMAIL PROTECTED] > For additional commands, e-mail: [EMAIL PROTECTED] > ********************************************************* Disclaimer: This message (including any attachments) contains confidential information intended for a specific individual and purpose, and is protected by law. If you are not the intended recipient, you should delete this message and are hereby notified that any disclosure, copying, or distribution of this message, or the taking of any action based on it, is strictly prohibited. ********************************************************* Visit us at http://www.mahindrabt.com --------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
