Return-Path: Delivered-To: apmail-jakarta-commons-user-archive@www.apache.org Received: (qmail 69341 invoked from network); 29 Jul 2004 08:55:25 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (209.237.227.199) by minotaur-2.apache.org with SMTP; 29 Jul 2004 08:55:25 -0000 Received: (qmail 82054 invoked by uid 500); 29 Jul 2004 08:55:18 -0000 Delivered-To: apmail-jakarta-commons-user-archive@jakarta.apache.org Received: (qmail 82002 invoked by uid 500); 29 Jul 2004 08:55:18 -0000 Mailing-List: contact commons-user-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Users List" Reply-To: "Jakarta Commons Users List" Delivered-To: mailing list commons-user@jakarta.apache.org Received: (qmail 81982 invoked by uid 99); 29 Jul 2004 08:55:17 -0000 X-ASF-Spam-Status: No, hits=0.0 required=10.0 tests= X-Spam-Check-By: apache.org Received: from [210.18.48.2] (HELO shardagate.mahindrabt.com) (210.18.48.2) by apache.org (qpsmtpd/0.27.1) with ESMTP; Thu, 29 Jul 2004 01:55:12 -0700 Received: from Interscan_sh ([10.5.2.145]) by shardagate.mahindrabt.com (8.12.10/8.12.10) with ESMTP id i6T8xUv1015031 for ; Thu, 29 Jul 2004 14:29:31 +0530 Received: from intranet.sharda.mahindrabt.com ([10.5.0.15]) by Interscan_sh with InterScan Messaging Security Suite; Thu, 29 Jul 2004 14:29:47 +0530 Received: from IMSS-1 ([10.5.3.66])by intranet.sharda.mahindrabt.com (8.12.10/8.12.10) with ESMTP id i6T9esKD022118for ; Thu, 29 Jul 2004 15:10:54 +0530 Received: from dscp00459 ([172.24.86.113]) by IMSS-1 with InterScan Messaging Security Suite; Thu, 29 Jul 2004 14:19:28 +0530 Message-ID: <00a801c4754b$3f7e5f20$715618ac@mahindrabt.com> From: "Rommel Sharma" To: "Jakarta Commons Users List" References: <41088995.8080106@kumachan.net.nz> <4108B192.5080101@kumachan.net.nz> Subject: [Commons FileUpload]understanding the source code Date: Thu, 29 Jul 2004 14:35:51 +0530 MIME-Version: 1.0 Content-Type: text/plain; charset=iso-8859-1 Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1437 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2800.1441 X-imss-version: 2.5 X-imss-result: Passed X-imss-scores: Clean:99.90000 C:21 M:2 S:5 R:5 X-imss-settings: Baseline:1 C:1 M:1 S:1 R:1 (0.0000 0.0000) X-Virus-Checked: Checked X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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: commons-user-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-user-help@jakarta.apache.org