File upload clarification

I followed the tutorial on how to upload/download files in an application and was successful in uploading and downloading to a custom table. However, can someone explain the purpose of the DELETE statement (below) that was included for uploading into a custom table:
IF ( :P2_FILE_NAME is not null ) THEN
INSERT INTO file_subjects(id,NAME, SUBJECT, BLOB_CONTENT, MIME_TYPE)
SELECT ID,:P2_FILE_NAME,:P2_SUBJECT,blob_content,mime_type
FROM HTMLDB_APPLICATION_FILES WHERE name = :P2_FILE_NAME;
DELETE from HTMLDB_APPLICATION_FILES WHERE name = :P2_FILE_NAME;
END IF;
Do all files that are uploaded have to go through the HTMLDB_APPLICATION_FILES before it is inserted into the custom table?

Hi 488473,
My understanding is that since your uploaded file is copied into the HTMLDB_APPLICATION_FILES table on your behalf, you need to remove it from there when you insert it into your own table, for the sake of good housekeeping.
Hope others will confirm or correct this understanding.
Petie

Similar Messages

  • Flat File Upload Clarification

    Hi All
    Can you please solve the below mentioned problem for me ..
    I am uploading the data from a Flat File to to the InfoCube
    I have got the folloing fields in the Flat File and the same fileds exists in the cube too.
    Cost Center,
    Profit Center
    Currency Type
    Fiscal Year/Period
    Posting Period
    Fiscal Year Variant
    Fiscal Year
    Currency
    Amount , Etc
    But in the Flat File Data Source in the PROPOSAL TAB for FISCALYEAR Field
    DATA Type shows as CURR
    FORMAT is EXTERNAL  and
    UNIT is CURRENCY
    any thing worng with the above description ?
    also when i am doing Transformations from data source to the cube I dont see the Corresponding 0CURRENCY Field in the INfocube list while all the other exists.
    please let me know what i need to do to map the Currency Field from the Flat file to the Cube Field ?
    regards
    Krishna Mohan

    Hi Nikil,
    thx my problem has been solved. I have done the same what you said for the transformations and regarding the flat file data source fileds i have chaged the data type and length for all the fields that were not right.
    full points awarded.
    regards
    Mohana Krishana

  • View temporary data in Web layout during file upload in Integrated Planning

    Hi Experts,
    When using File Upload funcationality, in Integrated Planning,
    I have a requirment, How user can view the data in the web layout?
    After data display user can make changes in the data and on click of Save the updated data is saved in cube.
    If any one has come across this requirment can you please help me out how things can be carried out?
    If "how to implement" document is present can you please provide me the link.
    Thanks and Regards,
    Abhi

    Hi Abhi,
    I assume, you are using WAD for this..
    Please do the following: (Please note the the cube has to be in Plan mode while executing WAD)
    1. Create a input enable query (through query designer) on th eaggregate level (the one you are using for IP). You might need to create filers for the aggregate level. these filters can also be used in the query.
    2. In the WAD, pull this query.
    3. Create a button in WAD and check for the planning functionalities readily available that you can use in WAD. One of the planning functionality is SAVE Data. This will save any data which is entered by the user.
    4. In the same button integrate a Refresh Data command after the SAVE data. This will automatically refresh the query and pull the updated/changed data from the cube.
    This should work. Please write back in case of any clarification.
    Regards, Rishi

  • BPC delta flat file upload possible?

    Hi experts,
    Ive been trying to find an answer of whether or not it is possible to retain member data on manual flat file upload into a dimension. We have created a dimension (employee) and have created some dummy nodes member data and would like to determine if it is possible to then keep this manual member data while manually loading further member data through flat file load. Is this sort of manual flatfile delta load possible? If so how? What is best practice here?
    Also, is it possible to load data into a dimension using two methods IE manual upload file and then another form (IE BW load) without overwriting data? Im assuming this is where the merge data option comes in to play.
    Any guidance would be much appreciated.
    Regards,
    Danielle

    Hi Danielle,
    While uploading data, if you have added dimension members manually, then, it never gets deleted untill and unless you specify for it.
    In your scenario, you have created dummy members and want to upload data thru flat file. Then, the data will be uploaded only for those members for which you want to upload data, rest of the members will display the old data.
    As you rightly said earlier, while running data manager package, you need to select MERGE option instead of REPLACE & CLEAR data values. This keeps the old data intact and adds the new ones as well.
    Hope this clarifies further.
    Rgds,
    Poonam

  • Error "A web exception has occurred during file upload" when trying to import ESXi image file into Update Manager

    I'm encountering this error and not sure how to fix, I'm quite new to vCenter so please bear with me.
    I'm trying out vCenter 5.1 with Update Manager 5.1 right now.  No license key has been entered and I still have 50 odd days to try it out.
    2 ESXi hosts are being managed by this vCenter, and they're both running ESXi 4.0
    I'm looking to use Update Manager to try to upgrade the ESXi 4.0 hosts to ESXi 5.1
    I downloaded the image file VMware-VIMSetup-all-5.1.0-799735.iso from VMWare website, and is looking to import it using the Update Manager so I can update the ESXi hosts, but I keep on getting the error:
    File name:     VMware-VIMSetup-all-5.1.0-799735.iso
    Failed to transfer data
    Error was: A web exception has occurred during file upload
    I tried importing it by using vSphere client to connect to vCenter server both remotely and locally, with firewall disabled.
    I've read http://kb.vmware.com/selfservice/microsites/search.do?language=en_US&cmd=displayKC&externalId=1026602
    I've disabled firewall, and there is no anti-virus program on the server.  I've also restarted the machine several times, to no avail, I didn't reinstall update manager because the whole Windows and VCenter installations are clean from scratch.
    I logged into the vSphere Client using Active Directory credentials, and I've made all Domain Admins (which my account is a member of) part of the administrator group on the vCenter server. I can't log in using admin@System-Domain because it tells me I don't have permissions for it, I still haven't really had the chance to figure out why that is and not sure if that makes a difference.
    Also, I'm fairly certain I'm using the right image file, as I've burned some DVD's used that image file to upgrade some other ESXi hosts.  Unless there's a special image file I need to download?
    I'm at lost on what I can do to make it work.  Please advise.
    Thanks.

    The ISO file you mentioned is the one for vCenter Server. What you need is the "VMware-VMvisor-Installer-5.1.0-799733.x86_64.iso" (or VMware-VMvisor-Installer-201210001-838463.x86_64.iso) for the ESXi host.
    André

  • Change upload file name with com.oreilly.servlet.MultipartRequest to handle the file upload

    1. when use com.oreilly.servlet.MultipartRequest to handle the file upload, can I change the upload file name .
    2. how com.oreilly.servlet.MultipartReques handle file upload? do it change to byte ?
    what  different?  if I use the following method?
       File uploadedFile = (File) mp.getFile("filename");
                   FileOutputStream fos = new FileOutputStream(filename);
                    byte[] uploadedFileBuf = new byte[(int) uploadedFile.length()];
                   fos.write(data);
                 fos.close();

    My questions are
    1) when use oreilly package to do file upload , it looks like i line of code is enough to store the upload file in the
    file direction.
    MultipartRequest multi =
            new MultipartRequest(request, dirName, 10*1024*1024); // 10MB
    why some example still use FileOutputStream?
    outs = new FileOutputStream(UPLOADDIR+fileName); 
        filePart.writeTo(outs); 
       outs.flush(); 
      outs.close();
    2) can I rename the file name when I use oreilly package?

  • BI IP --- Planning function for File Upload

    Hai All,
    In BI IP , When I am trying to load the data (text file) by using Planning function for File Upload. I am getting an error message When I am clicking on Update .
    Error Message : Inconsistent input parameter (parameter: <unknown>, value <unknown>).
    In Text file I am using Tab Separation for each value
    Anyone help me out.
    Thanks,
    Bhima

    Hi Bhima
    Try one of these; it should work:
    1. If you are on SP 14 you would need to upgrade to SP 15. It would work fine
    2. If not, then -
         a] apply note 1070655 - Termination msg CL_RSPLFR_CONTROLLER =>GET_READ_WRITE_PROVIDS
         b] Apply Correction Instruction 566059 [i.e: in Object - CL_RSPLFR_CONTROLLER GET_READ_WRITE_PROVIDS,
    delete the block: l_r_alvl = cl_rspls_alvl=>factory( i_aggrlevel = p_infoprov ).
    and insert block - l_r_alvl = cl_rspls_alvl=>factory( i_aggrlevel = i_infoprov ).
    Goodluck
    Srikanth

  • FILE UPLOAD PROBLEM SHOWING THE CONTENTS IN THE SAME BROWSER WINDOW

    Hi,
    This is amit Joshi
    I have uploaded content using input tag of type file and posted to jsp as multipart/form-data type
    in that jsp i am using following code to display the content in browser but only first content is displayed How can i modify it to show all content in the file ..
    <html>
    <head>
    <title>File Upload Display</title>
    </head>
    <body>
    <%
    //ServletOutputStream sout=response.getOutputStream();
    StringBuilder strBuilder = new StringBuilder();
    int count=0;
    String f;
    f=request.getParameter("filedb");
    DBManager dbm = new DBManager();
    //dbm.createTable("mms3");
    //log.info("In JSP : "+ f);
    //dbm.insert_data(f,"mms3");
    %>
    <%
    if (ServletFileUpload.isMultipartContent(request)){
    ServletFileUpload servletFileUpload = new ServletFileUpload(new DiskFileItemFactory());
    List fileItemsList = servletFileUpload.parseRequest(request);
    strBuilder.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>").append('\r').append('\n').append("<xpage version=\"1.0\">").append('\r').append('\n');
    String optionalFileName = "";
    FileItem fileItem = null;
    Iterator it = fileItemsList.iterator();
    ServletOutputStream outputStream=null;
    while (it.hasNext()){
    FileItem fileItemTemp = (FileItem)it.next();
    if (fileItemTemp.isFormField()){
    %>
    <b>Name-value Pair Info:</b>
    Field name: <%= fileItemTemp.getFieldName() %>
    Field value: <%= fileItemTemp.getString() %>
    <%
    if (fileItemTemp.getFieldName().equals("filename"))
    optionalFileName = fileItemTemp.getString();
    else
    fileItem = fileItemTemp;
    if (fileItem!=null){
    String fileName = fileItem.getName();
    %>
    <b>Uploaded File Info:</b>
    Content type: <%= fileItem.getContentType() %>
    Field name: <%= fileItem.getFieldName() %>
    File name: <%= fileName %>
    <%
    if(fileItem.getContentType().equals("image/jpeg")) { %>
    File : <p><%
         //response.setContentType("image/gif");
         byte[] bArray=fileItem.get();
         response.setContentType("image/jpeg");
         outputStream=null;
         outputStream= response.getOutputStream();
         outputStream.write(bArray);
         outputStream.flush();
         outputStream.close();
    else if(fileItem.getContentType().equals("text/plain"))
         %> File : <%= fileItem.getString() %>
    <%
    byte[] bArray=fileItem.get();
    response.setContentType("text/plain");
         outputStream = response.getOutputStream();
         out.println();
         outputStream.write(bArray);
         outputStream.flush();
         outputStream.close();
    %> </p> <%
    %>
    </body>
    </html>
    Edited by: Amit_Joshi on Nov 13, 2007 10:58 PM

    Well Well Well..
    That would not work...
    What you have to do is save the uploaded file content on to a location and then pass the fileName as a request parameter to a deidicated which displays the contents of that file.
    Just as an example
    <html>
    <head>
    <title>File Upload Display</title>
    </head>
    <body>
    <%
    //ServletOutputStream sout=response.getOutputStream();
    StringBuilder strBuilder = new StringBuilder();
    int count=0;
    String f;
    f=request.getParameter("filedb");
    DBManager dbm = new DBManager();
    //dbm.createTable("mms3");
    //log.info("In JSP : "+ f);
    //dbm.insert_data(f,"mms3");
    %>
    <%
    if (ServletFileUpload.isMultipartContent(request)){
    ServletFileUpload servletFileUpload = new ServletFileUpload(new DiskFileItemFactory());
    List fileItemsList = servletFileUpload.parseRequest(request);
    strBuilder.append("<?xml version=\"1.0\" encoding=\"UTF-8\" ?>").append('\r').append('\n').append("<xpage version=\"1.0\">").append('\r').append('\n');
    String optionalFileName = "";
    FileItem fileItem = null;
    Iterator it = fileItemsList.iterator();
    ServletOutputStream outputStream=null;
    while (it.hasNext()){
       FileItem fileItemTemp = (FileItem)it.next();
    %>
    Name-value Pair Info:
    Field name: <%= fileItemTemp.getFieldName() %><br/>
    Field value: <%= fileItemTemp.getString() %><br/>
    <%
    if (fileItemTemp.getFieldName().equals("filename"))
        optionalFileName = fileItemTemp.getString();
    if(!fileTempItem.isFormFiled()){
       String fileName = fileItem.getName();
       fileItem.write(optionalFileName);
    %>
    Uploaded File Info:
    Content type: <%= fileItem.getContentType() %><br/>
    Field name: <%= fileItem.getFieldName() %><br/>
    File name: <%= fileName %><br/>
    <%
    if(fileItem.getContentType().equals("image/jpeg") || fileItem.getContentType().equals("image/pjeg")) {
    %>
      <img src="FileServlet?fileName=<%=optionalFileName%>"   
    <%
    %>
    </body>
    </html>a sample code snippet for FileServlet.
    String fileName =  request.getParameter(fileName);
      File file = new File(fileName);
       if(!file.exists())
         return;
      // If JSP
      String mimeType = application.getMimeType("fileName");
           If you are using servlet
           String mimeType = this.getServletContext().getMimeType(fileName);
         response.setContentType(mimeType);  
         response.setHeader("Content-Disposition","inline;filename=\\"+fileName+"\\");
      BufferedOutputStream out1 = null;
      InputStream in = null;
      if(mimeType == null)
         mimeType = "application/octet-stream";
      try{
         in = new FileInputStream(f);
         response.setContentLength(in.available());
         BufferedOutputStream out1 = new BufferedOutputStream(response.getOutputStream(),1024);
         int size = 0;
         byte[] b = new byte[1024];
         while ((size = in.read(b, 0, 1024)) > 0)
            out1.write(b, 0, size);
      }catch(Exception exp){
      }finally{
          if(out1 != null){
             try{
                out1.flush();               
                out1.close();
             }catch(Exception e){}
          if(in != null){
            try{in.close();}catch(Exception e){}
      } Hope that might answer your question :)
    However,this is not the recommended way of doing this make use of MVC pattern.Would be a better approach.
    you might think of googling on this and can findout what is the best practise followed for problems of this sort
    REGARDS,
    RaHuL

  • Unable to get the filename from file upload UI element

    Hi,
    I added a FileUpload UI element.
    I created an attribute of type resource , assigned to the resource property of the file upload element.
    I created an action button called upload and added the following code.
    try {
           IWDResource resource = wdContext.currentContextElement().getFileupload();
          } catch (Exception e) {
             e.printStackTrace();
    when I debug to see the value of resource it is null.
    Please let me know where I am going wrong.
    Regards,
    Narayani

    Hi,
    Check if there are any space characters in your uploading path (file path).
    First try to upload a file without any space characters in the uploading path(file path). If the problem is with the space characters then use the below encoding & decoding to resolve that issue.
    Encoding while uploading the file:
    // Getting the file resource
    IWDResource resource = element.getCtx_va_FileResource();
    //Getting the resource name
    String resourceName = resource.getResourceName();
    //Encoding the resource name
    String encoderesourceName = java.net.URLEncoder.encode(resourceName,"UTF-8");
    Again while downloading you can use decoder.
    Hope this helps to resolve your issue.
    See this below link.
    Re: File Upload Problem
    Try this encoding even if there are no space characters.
    Regards,
    Charan

  • File Upload UI element is not working properly inside Table Popin container

    Hi Expert,
    I created a table with popin, i placed file-upload UI element inside table popin contatiner.
    The file upload UI element is displaying properly but, when i click the browse button to select  the file, the file open dialog box is not popping out.
    will table popin support file-upload UI element inside it?
    it not is there any other way to call a file_open dialog box from inside the table popin.
    Thanks,
    James

    If you are on NetWeaver 7.01, you can try both the ACFUpDownload UI element or try creating your own FileUpload in Adobe Flex with Flash Islands.  ACFUpDownload requires the KPRO by default (which is why the same application isn't working for you), but you can write your own handler class to act as the KPRO receiver.  Here is an eLearning on the topic:
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/109b9b52-bc00-2c10-8786-e4c5e96d7e04
    and source code:
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/70645070-bb00-2c10-f086-f126721acdb4
    If you want an eLearning on the FlashIslands approach, you can find it here as well:
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/50d42644-91ef-2b10-228c-9e0ae75b274e
    and Source Code:
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/f044b62c-90ef-2b10-64a6-9ec25294d133
    However in both of these approaches you still have to be careful with how you handle large files.  The problem is that they are processed often a single binary string.  This makes the processing easy, but requires total amount of session memory at least as large as the file being uploaded.  In NetWeaver 7.02 ABAP adds the concept of Streams and Locators to help with the partial processing of large files.  This feature doesn't come until later this year, but if you are interested you can learn about it here:
    https://www.sdn.sap.com/irj/scn/go/portal/prtroot/docs/library/uuid/80f983df-213e-2c10-ba89-b5a12ef178e8

  • File Upload applet not opening in Query Mode

    File Upload Applet is opening in Query Mode in Siebel 7.5, where as in Siebel 7.8 its not opening in Query Mode.
    Should anything be changed in CFG? or siebel restricted this?

    Hi,
    There is a property called "Auto Query Mode" in the applet. Check whether this has been set to "New Query" in 7.5. If so the applet will be opening in Query Mode automatically. If this property is blank, in 7.8, the applet will not be opening in Query mode. Check and let me know.
    Regards,
    Joseph

  • Threading problem during File Upload with Apache faces upload tag

    First I am going to tell you "My Understanding of how JSF Apache Upload works, Correct me if i am wrong".
    1) Restores View (to show Input box and Browse button to facilitate users to select a file for upload)
    2) Translates Request Parameters to Component Values (Creates equivalent components to update them with request values).
    3) Validates Input(Checks to see whether the User has input the correct file)
    4) Updates Backing Bean or Model to reflect the values.
    5) Renders response to user.
    I am uploading huge files of sizes 400MB and above with the help of JSF apache extensions tag
    <h:form id="uploadForm" enctype="multipart/form-data">
    <x:inputFileUpload style="height:20px;" id="upload" value="#{backingbean.fileContents}" storage="file" size="50" />
    </h:form>
    In the backing bean
    private UploadedFile fileContents;
         public UploadedFile getFileContents() {
              return fileContents;
         public void setFileContents(UploadedFile fileContents) {
              System.out.println("File being uploaded...");
              this.fileContents = fileContents;
    Since, the file size is so huge, I am using temp folder to use for the apache tag instead of memory.
    In web.xml i am using like this
    <filter>
    <filter-name>ExtensionsFilter</filter-name>
    <filter-class>org.apache.myfaces.component.html.util.ExtensionsFilter</filter-class>
    <init-param>
    <param-name>uploadMaxFileSize</param-name>
    <param-value>600m</param-value>
    </init-param>
    <init-param>
    <param-name>uploadThresholdSize</param-name>
    <param-value>10m</param-value>
    </init-param>
         <init-param>
    <param-name>uploadRepositoryPath</param-name>
    <param-value>/uploadfolder/</param-value>
    </init-param>
    </filter>
    <filter-mapping>
    <filter-name>ExtensionsFilter</filter-name>
    <servlet-name>Faces Servlet</servlet-name>
    </filter-mapping>
    The upload process is working perfectly fine.
    Now coming to the problem:
    Suppose one user is logging into the application & uploading say 400MB of files.
    Until these files are linked to the model objects as my understanding of step 2, if second user tries to open the application he gets stuck with the loading page.
    The page gets loaded only after the request files are linked to the component values(Step 2 above) and updates the backing bean's values.
    I don't see any error in the logs. User is getting stuck. The user is getting stuck only when uploading the files. The other operations like searching are not blocking any other activities performed by the user.
    Server used: IBM Application Server V6.0. CPU is normal, memory usage is normal.

    Dear friend,
    i am also trying to upload using the common file upload.
    when try to run the file error is coming
    can give some suggestion.
    can i use if concurrent user file upload at a time

  • File Upload element Problem

    Hello All,
    We have a problem regarding the File Upload button in Webdynpro.
    when we upload a file using this element and goto another view and comeback, the upload element is not showing any filename.
    But when debugged, the fileupload context node still has the data. Just it is not showing in the UI.
    Is it an existing problem with File Upload? Or do we have to do anything to make the filename visible.
    Thanks,
    Anand

    Hi,
    this works as designed, see the section on browser details <a href="http://help.sap.com/saphelp_nw70/helpdata/en/b3/be7941601b1d09e10000000a155106/frameset.htm">here</a>
    Regards, Heidi

  • File Upload demo problem

    Hi!, i have a problem with the File Upload Demo when it calls this line:
    hDirectoryObject := JFile.new(directory);
    and the error is: error 6508 "PL/SQL: could not find program unit being called"
    That's ok, but anybody knows why should the program couldnt find the routine ?
    And just one more thing...where can i look for JFile method description ??
    Thanks a lot :) !!
    Cristian.

    Is this 9i or 6i?
    JFile is an imported wrapper for a Java Class - it should be in the Demo form already - you could try a compile all on the file just in case.

  • File Upload.. Strange Problem..

    im trying to read file data and print it in the browser. I dont want to save the file. just to read the uploaded file which is TAB delimited..
    First time it works fine. but If I browse back button and reload another file and submit. I am getting content of first file and second file. I closed the browser and reopened it but still problem is not resolved. it keeps on adding file content instead of showing current uploaded file. I dont know what to do.
    here is my code
    upload.html
    <html>
    <head>
    <title>File Upload Form</title>
    </head>
    <body>
    Upload File using this..
    <FORM METHOD="POST" ENCTYPE="multipart/form-data" action="uploadFile.jsp">
    File: <input type="file" name="file"><br>
    <input value="Submit" type="submit">
    </form>
    </body>
    </html>
    UploadFile.jsp
    =============
    <%@page language="java" import="java.io.*" %>
    <%@page language="java" import="java.util.*" %>
    <%!
    private BufferedInputStream bis = null;
    int MAX_LINES = 2000;
    private String currentLine = "";
    //private String[] PartNumber;
    //private String[] Quantity;
    public int disp_counter = 0;
    public int mime_counter = 0;
    public int boundary_counter = 0;
    private String content_diposition = null;
    private HttpServletRequest request;
    private javax.servlet.jsp.JspWriter mOut;
    The incoming request needs to be an InputStream before it can be parsed. This method creates an InputStream from the request. The
    request contains the uploaded file contents
    public void setInputStream(HttpServletRequest request, JspWriter _out)throws IOException {
    try{
    bis = new BufferedInputStream(request.getInputStream());
    } catch(IOException e){
    e.printStackTrace();
    this.request = request;
    this.mOut = _out;
    //mOut.println("After setting input Stream<br>");
    private int getRealContentLength() throws Exception
    boundary_counter = readBoundaryLength(bis);
    content_diposition = readContentDisposition(bis);
    //mOut.println(" getRealContentLength() content_diposition ="+content_diposition+"<br>");
    mime_counter = readUntilBody(bis);
    int tmpContentLength = getContentLength();
    int retLength;
    mOut.println(" getRealContentLength() boundary_counter ="+boundary_counter+"<br>");
    mOut.println(" getRealContentLength() content_diposition ="+content_diposition+"<br>");
    mOut.println(" getRealContentLength() disp_counter ="+disp_counter+"<br>");
    mOut.println(" getRealContentLength() mime_counter ="+mime_counter+"<br>");
    mOut.println(" getRealContentLength() tmpContentLength ="+tmpContentLength+"<br>");
    retLength = getContentLength()-boundary_counter-2-mime_counter-disp_counter;
    return retLength;
    private int readBoundaryLength(BufferedInputStream fis) throws Exception{
    //mOut.println("---- Inside readBoundaryLength ----<br>");
    StringBuffer sb = new StringBuffer();
    byte[] b = new byte[1];
    int counter=0;
    while(true){
    try{
    fis.read(b);
    counter++;
    //mOut.println("RB "+counter+"="+b[0]+"<br>");
    sb.append( new String(b));
    //if('\r'==b[0])
    if(13==b[0]){
    fis.read(b);
    sb.append( new String(b));
    //mOut.println("RB next="+b[0]+"<br>");
    break;
    }catch(IOException e){
    e.printStackTrace();
    //mOut.println("----Counter before return="+counter+" STR="+sb.toString()+"----<br>");
    b = null;
    //mOut.println("---- End readBoundaryLength ----<br>");
    return counter+1;
    private int readUntilBody(BufferedInputStream fis) throws Exception{
    byte[] b = new byte[1];
    mime_counter=0;
    int counter = 0;
    StringBuffer sb = new StringBuffer();
    while(true){
    try{
    fis.read(b);
    sb.append(new String(b));
    mime_counter++;
    //mOut.println("RUntilB "+mime_counter+"="+b[0]+"<br>");
    //if('\r'==b[0])
    if(13==b[0])
    counter++;
    if(counter == 2){
    fis.read(b);
    sb.append(new String(b));
    //mOut.println("RUntilB counter=2 "+mime_counter+"="+b[0]+"<br>");
    break;
    }catch(IOException e){
    e.printStackTrace();
    b = null;
    //mOut.println("RUntilB="+sb.toString()+"<br>");
    return mime_counter;
    private int getContentLength(){
    return request.getContentLength();
    private String readContentDisposition(BufferedInputStream fis) throws Exception{
    byte[] b = new byte[1];
    disp_counter=0;
    StringBuffer sb = new StringBuffer();
    while(true){
    try{
    fis.read(b);
    disp_counter++;
    sb.append(new String(b));
    //mOut.println("ReadCD "+disp_counter+"="+b[0]+"<br>");
    //if('\r'==b[0])
    if(13==b[0]){
    for(int i=1; i < 2; i++){
    sb.append(new String(b));
    fis.read(b);
    //mOut.println("ReadCD before break="+b[0]+"<br>");
    break;
    }catch(IOException e){
    e.printStackTrace();
    //mOut.println("----disp_counter before return="+disp_counter+" STR="+sb.toString()+"----<br>");
    b=null;
    disp_counter += 1;
    return sb.toString();
    private String readNumberOfBytes(BufferedInputStream bis, int count) throws Exception{
    byte[] b = new byte[count];
    byte[] tmp = new byte[count];
    int offset = 0;
    int icount = count;
    int i=0;
    String tmpStr = null;
    try{
    while((i = bis.read(b,0,icount)) != -1){
    System.arraycopy(b,0,tmp,offset,i);
    tmpStr = new String( tmp );
    //mOut.println( "*****"+tmpStr );
    if(icount - i > 0) {
    icount = count - i;
    offset +=i;
    continue;
    else
    break;
    }catch(IOException e){
    e.printStackTrace();
    //for (i=0; i<b.length; i++)
    // mOut.println("AC"+i+"="+b+"<br>");
    return tmpStr;
    public String parseFile( ) throws Exception {
    int len = readAll(bis);
    mOut.println("total len="+len+"<br>");
    //in the first phase, throw away the request parameters that are not required
    //in the second phase, grab the required stuff
    int reallength;
    int mod = 0;
    int div = 0;
    //get rid of the unwanted request content
    reallength = getRealContentLength();//this is the orig line
    //mOut.println( "reallength is " + reallength +"<br>");
    //get rid of boundary and content disp header.
    //int bound_len = readBoundaryLength(bis);
    //String content_disp = readContentDisposition(bis);
    //mOut.println( "Xbound_len" + bound_len +"<br>");
    //mOut.println( "xcontent_disp" + content_disp +"<br>");
    //now we are at partnos,qty
    //int body = readUntilBody(bis);
    if(reallength < 2048){
    currentLine += readNumberOfBytes(bis,reallength);
    else{
    div = reallength / 2048;//buffer default size
    mod = reallength % 2048;
    mOut.println("div ="+div+" mod="+mod+"<br>");
    for(int i=0; i < div; i++)
    currentLine += readNumberOfBytes(bis,2048);
    if(mod != 0)
    currentLine += readNumberOfBytes(bis,mod);
    //mOut.println( "currentLine" + currentLine );
    //ExtractPartNumberAndQuantity();
    //mOut.println("total length="+currentLine.length()+"<br>");
    int lastInd = currentLine.lastIndexOf('\r');
    //mOut.println("lastInd="+lastInd+"<br>");
    lastInd = currentLine.lastIndexOf('\r',lastInd-1);
    //mOut.println("lastInd="+lastInd+"<br>");
    currentLine= currentLine.substring(0,lastInd);
    //mOut.println( "currentLine="+currentLine+"<br>" );
    return currentLine;
    %>
    <%
    out.println(" request length="+request.getContentLength()+"<br>");
    setInputStream(request,out);
    String allLines = parseFile();
    out.println("************** Parsing string starts <br>");
    StringBuffer sb = new StringBuffer();
    sb.append( (char)13 );
    sb.append( (char)10 );
    StringTokenizer st = new StringTokenizer( allLines,sb.toString());
    String line = null;
    // skip the first line as this is header...
    if( st.hasMoreTokens() )
    line = st.nextToken();
    while( st.hasMoreTokens() )
    line = st.nextToken();
    out.println(line+"<br>");
    out.flush();
    %>

    err..
    <%!
    private BufferedInputStream bis = null;
    int MAX_LINES = 2000;
    private String currentLine = "";
    //private String[] PartNumber;
    //private String[] Quantity;
    public int disp_counter = 0;
    public int mime_counter = 0;
    public int boundary_counter = 0;
    private String content_diposition = null;
    private HttpServletRequest request;
    private javax.servlet.jsp.JspWriter mOut;
    that's the problem, most likely.... the <%! part to hold all the variables. Particularly coudl've been a problem if you have multple requests at the same time..

Maybe you are looking for

  • Sqlserver time out when use multiple leftjoin in searcing

    Can anyone explain what reason cause follow #2,#3,#4,#5, i'm confusing for this problem in whole afternoon . thank you very much. you can copy the follow small example to see the timeout issue , if your pc is too quick, haven't yet see timeout issue

  • Slight Problem with Applet

    I am done making a current applet that I am working on it. I made the html, ran it in IE, and..I got an error. Here is the first one of many, and I think it is the main one: java.security.AccessControlException: access denied (java.io.FilePermission

  • IPhoto - Sync with 3GS and 4G

    Hi there, Help please. Strangely enough but none of my photos and videos in iPhoto can sync with both of my phones (3GS and 4G). Both worked just fine a couple of days ago. What is going on? Please help. Thanks

  • Deltas and full upload

    Hi all, Let's say we have a scenario like this. For document number 1001 and document item number 10, the order quantity was 200 initially. This was transferred to infocube. Now, the order quantity changed to 180. I assume that in a delta upload, -20

  • Create EDL with DPX files trouble

    Hi everyone. I have a problem exporting edls from a sequence containing dpx file formats. The exported edl writes the dpx sequences as BL (blacks). for example 001 BL V C 00:00:00:00 00:00:04:05 01:00:00:00 01:00:04:05 *FROM CLIP NAME: 01_0000.DPX FI