How to divide the request.getInputStream()?

I use a form in a web page to update files, the form code is
<form action="/Mywork/servlet/fileupdate1" method="post" enctype="multipart/form-data">
<p>
Please select a file1 to upload: <input type="file" name="foo">
</p>
<p>
Please select a file2 to upload:<input type="file" name="foo1">
</p>
<input type="submit" value="Upload File!">
</form>
and the "fileupdate1" servlet which the "action" in the form tag refers to will get the inputstream by
"ServletInputStream servIn = request.getInputStream();", and create new OutputFileStream in the disk. But
new files which the servlet stored always have some additional codes "
-----------------------------7d419320202be
Content-Disposition: form-data; name="foo"; filename="H:\Documents and
Settings\administrator\desktop\ee.java"
Content-Type: application/octet-stream
If I updating two files, each file will has these kinds of codes and the two files only have one inputstream. I don't
how to remove these additional codes and how to divide the stream into pieces according to the updated-file-size.
I don't know wether I say it clearly?And
does anyone know the reasons and can help me?
Thank you very much.

Well, if you know the format, you'd know that the file data starts after the first blank line (\r\n\r\n).
But why don't you just use Jakarta Commons File Upload or some other existing free package to handle multipart forms and save yourself the trouble.

Similar Messages

  • Who knows: How to divide the request.getInputStream()?

    I use a form in a web page to update files, the form code is
    <form action="/Mywork/servlet/fileupdate1" method="post" enctype="multipart/form-data">
    <p>
    Please select a file1 to upload: <input type="file" name="foo">
    </p>
    <p>
    Please select a file2 to upload:<input type="file" name="foo1">
    </p>
    <input type="submit" value="Upload File!">
    </form>
    and the "fileupdate1" servlet which the "action" in the form tag refers to will get the inputstream by
    "ServletInputStream servIn = request.getInputStream();", and create new OutputFileStream in the disk. But
    new files which the servlet stored always have some additional codes "
    -----------------------------7d419320202be
    Content-Disposition: form-data; name="foo"; filename="H:\Documents and
    Settings\administrator\desktop\ee.java"
    Content-Type: application/octet-stream
    If I updating two files, each file will has these kinds of codes and the two files only have one inputstream. I don't
    how to remove these additional codes and how to divide the stream into pieces according to the updated-file-size.
    I don't know wether I say it clearly?And
    does anyone know the reasons and can help me?
    Thank you very much.

    Use something like Jakarta Commons FileUpload to process the multipart/form-data request:
    http://jakarta.apache.org/commons/fileupload/

  • How to delete the request in se10

    Hi Experts,
    How to delete the request in se10 ....plz explain
    Regards
    Venkat

    Hi,
    Go to SE10,select the request which you wnat to delete.You will find a delete icon on the top.Select it.
    This will delete the request.
    Make sure that this request is the one which is under ur ID.If you want to delete the request which is under other ID,it wont allow to delete.
    Thanks & Regards,
    Suchitra.V

  • How to unlock the request for a report and add the same query to new reques

    hi,
         how to unlock the request for a  and add the same query to new reques

    You can unlock in SE03 tcode.
    Goto tcode SE01, give the transport number --> display --> double click on the transport --> in the next screen select all the elements --> delete --> save.
    To attach it to another transport, In RSA1, click on transport connection> Choose Object types> query elements --> here you can find your query/ or you can search, which you can drag to right and attach to the transport (using truck button).

  • How to forward the request

    hi all,
    can somebody tell me how to forward the request from one context to another.
    thanks in adv.
    ritu

    Ritu, when you are talking about a different context are you talking about application, session and page contexts?? If yes, then I don't think you can forward a request to another context!
    If you are after a context (bean) from within your servlet, have you tried:
    mycontext = (MyContextClass)getServletContext().getAttribute("thenameofmycontext");HTH.

  • How to divide the partitions in AIX 5L

    Hi Guru's
    Friends i am installing AIX 5L, How to divide the partitions in AIX5L
    please tell me if anybody know.
    Thanks

    What kind of partitions do you mean? Do you mean logical partitions?
    Message was edited by:
    Ivan Kartik

  • How to divide the CRM transaction data by company cord?

    How to divide the CRM transaction data by company cord?
    CRM transaction have not company cord, so how to divide the data on BI report by company cord?
    Do I have to get the sales organization from customer master?
    Some transactions have not master data like lead. I want to know your experience.

    Hi
    This is self reply.
    I should use the sales organization instead of company cord.
    But some business like lead from contact from customer can not separate the company, in situation one call center for multiple companies.
    We should use another field to divide the company. Ex. Product, campaign, etc.
    If someone knows better way to solve this issue, let me know the reply.
    Regard
    u1

  • How to divide the iview into frames?

    Hi Experts,
                  Please tell me how to divide the iview into frames.Kindly provide the   steps.Its urgent.
    Regards,
    Nutan

    Hi Nutan,
    Now its clear!!
    If I understand right. You want an overview page full of links to go to your different pages?
    Or maybe you want a link form each page to go to another page?
    In Portal Navigation through hyperlinks is possible.
    You can either do that using EPCM.doNavigate("ROLES://...") {check for EPCM API of help.spa.com}
    Or you could do that by simple
    <a href="http://www.sdn.sap.com/irj/portal/myql">CLICK</a>
    {check for Quicklinks on help.sap.com}
    Either way you'll have to make a small JSP for that.
    Hope this helped
    If so kindly reward with points
    Prem

  • How 2 capture the request in background

    Hi,
    how 2 capture the request in background
    Thanks

    Hi,
    My question is ,
    while creating any object we generally assign that to particular request .
    I have one object XXXX . I want to find which request is assigned to this object . i want to know.
    Thanks

  • How to create the request for change of selection text into other language.

    Hi,
    In my object requirement is that when login through Japanese language,  then on selection screen selection text should appear in Japanese language. For that I have maintained the text in Japanese language the program where we define the selection text there from translation I have maintained the text in Japanese but while maintain the text it didn't ask me for REQUEST, because of that I am not able to transport the changes to next system, so I want know how to create the request for this case.
    Thanks

    Hello Chetan,
    You could goto the selection screen texts by goto-> selection texts,
    Then you could again goto -> Translation
    or
    Other-> Translation(Not sure )
    Then double click on the Program you should be able to see the Texts that need translation, now change something save and come back and try to activate, now it should propose for a new Transport Request.
    Either create a new transaport request or give one that you have given for the program.
    Hope the issue is resolved.

  • How  to find the Request in R/3??

    HI Guru's
    I have done the Re-process of InfoPackage in BW and the data is coming from R/3
    I want to see the request in R/3
    I know the request in R/3 will start with BI
    but i don't know how to see in R/3
    any help much appreciated...
    Regards,
    BH

    Hi BH,
    If you want to see the status of the extraction job you can go directly from the monitor screen (Path- Environment->Jobv Overview->In the Source system). Give your login and you should be able to see the job.
    Alternatively you can use tcode sm37 to goto the Job Monitor screen and give the job id(BI appended with the request id in BW).
    Hope that helps.
    Regards.

  • How to delete the Request Number

    Hi all,
                 How to delete the Requset Number in Development Client.Already i transported this Req. Number to Tesing Client.

    For what purpose, deleting the request number won't restore your dev system. You can remove the request from the import queues via transaction STMS to insure it will not be accidentally imported.
    You can usually only destroy a request in source system if it has not been released and all objects are unlocked, but this is risky in some cases and may cause a loss of information or coherence.
    Regards

  • How to display the request date in query

    Hi,
    I want to display the No. of request ID and request date in the query, but how could I get the  request date?
    Can anyone give me some suggestion?
    Thanks
    Huaiyuan

    Hi,
    By "request date" you mean the loading process "request date" ?
    If so, as Diogo said, add an infoObject in your data provider for this, but you won't be able to collapse anything if that's a cube.
    Thanks
    Matthieu

  • How to get the request xml string in Business service.

    Hi
    I have following requirement
    1) XAI inbound service will get a input xml request feed and call the Business Service.
    2) Business service will do some validation and do the insert in the database.
    My BS schema is as below
    <schema pageAction="change">
    <personId mapField="PER_ID"/>
    <personOrBusiness mapField="PER_OR_BUS_FLG"/>
    <name mapField="ENTITY_NAME" mdField="C1_ENTITY_NAME"/>
    <emailAddress mapField="EMAILID"/>
    <city mapField="CITY"/>
    <county mapField="COUNTY"/>
    <postal mapField="POSTAL"/>
    <houseType mapField="HOUSE_TYPE"/>
    <taxVendorGeographicalCode mapField="GEO_CODE"/>
    <isInCityLimit mapField="IN_CITY_LIMIT"/>
    <state mapField="STATE"/>
    <version mapField="VERSION"/>
    <division mapField="CIS_DIVISION"/>
    <accessGroup mapField="ACCESS_GRP_CD"/>
    <address1 mapField="ADDRESS1"/>
    <personCharacteristic type="list" mapList="CI_PER_CHAR">
    <personId mapField="PER_ID"/>
    <characteristicType mapField="CHAR_TYPE_CD"/>
    <characteristicValue mapField="CHAR_VAL"/>
    <effectiveDate mapField="EFFDT"/>
    <adhocCharacteristicValue mapField="ADHOC_CHAR_VAL"/>
    <characteristicValueForeignKey1 mapField="CHAR_VAL_FK1"/>
    <characteristicValueFK2 mapField="CHAR_VAL_FK2"/>
    <characteristicValueFK3 mapField="CHAR_VAL_FK3"/>
    <characteristicValueFk4 mapField="CHAR_VAL_FK4"/>
    <characteristicValueFK5 mapField="CHAR_VAL_FK5"/>
    </personCharacteristic>
    </schema>
    The request XML to BS is as below_
    (support.schema.AbstractSchemaBasedDispatcher) Performing page:change of BusinessService CM_SPRDSHT_BS' (service='CMSPRDHSHTUPLD'), with input request
    <?xml version="1.0" encoding="UTF-8"?>
    <CM_Person>
    <personOrBusiness>P</personOrBusiness>
    <name>Marsh,Corporate</name>
    <emailAddress>[email protected]</emailAddress>
    <city>Tampa</city>
    <country>USA</country>
    <postal>2131</postal>
    <houseType/>
    <taxVendorGeographicalCode/>
    <isInCityLimit/>
    <state>CA</state>
    <version>1</version>
    <division>930</division>
    <accessGroup>***</accessGroup>
    <address1>Address of Khan</address1>
    </CM_Person>
    I can access the values of each xml node in BS with the help of data item.
    I wanted to know how can I get the above request xml string in my Business Service in Java.

    {color:#0000ff}http://java.sun.com/javase/6/docs/api/java/lang/Integer.html#parseInt(java.lang.String)
    http://java.sun.com/javase/6/docs/api/java/lang/Integer.html#valueOf(java.lang.String){color}

  • How to change the requested delivery date when approval has been done

    Hi
    We use SRM5.0 and we want to implement SC, now we want to make it possible to change the delivery date in the shopping cart when we approve.
    This is needed if we request today but the approver didn't approve same day, therefore the requested day has to move the same number of days, that the approver has spend. Or else the deliver date will not be correct.
    Do any of you know how to do this??
    Best regards
    Jakob

    Hi Jakob,
    What scenario do you use? Classic, Extended Classic, Standalone?
    So depending on your scenario you can have differente types of follow-on documents (PR/PO only in ERP in case of Classic, or PO in SRMand ERP in case of Extended Classic).
    Do you use Sourcing Cockpit?
    I've tested this scenario in SRM 7.0 Standalone and if the follow-on document (in my case, a PO) is not "Ordered" yet then I can change the SC. But if it is already "Ordered", I can't change the SC. This is standard behavior.
    You could use Sourcing Cocking to solve this issue, in this you don't use it yet.
    Best regards,
    Christian Zeuch

Maybe you are looking for

  • Pulse audio broken after update.

    I've got arch 64bit latest. AMD 8120 16gb of RAM I've ran pacman -Syu and it seemed to have updated pulseaudio or something related, however now pulse isn't working. This is the report from pulseaudio -v slimg00dy@Myhouse etc]$ pulseaudio --start E:

  • Generating for Multiple forms

    Hi all, How can i generate Object list report for multiple no of forms. for individual forms i can go to file-> Administration->Object list report in any FMB. since i have to generate the same thing for multiple fmb's...how is it possible..do we need

  • How to call custom API in ODI

    Hi All,how to call custom API in ODI and how can multiple people run the scenario at same time. I explained my process below 1. Through ODI console pass parameter (file name) to scenario and read the file form configured location 2. Insert the data f

  • REP-52251: Cannot get output of job ID

    Hi, I am trying to call a report from oracle form and i am getting this error REP-52251: Cannot get output of job ID 220 you requested on Mon Oct 16 11:19:12 EDT 2006. REP-56033: Job 220 does not exist please help, any Ideas. Best regards,

  • What are the similarities of the feudal system in medieval Europe and Japan

    Guys, I don't know how to access google.