How to read a file as an input stream after it's posted in an HTML form ?

Hello,
I want to read client file after it's posted in an HTML form. But, I don't want to upload it to filesystem or database. I want to read posted file as an input stream. How can I do that ?
thanks in advance...

A couple of things. If you have a FILE field in your form, the enctype of the form must be multipart/form-data. Check this link
http://www.htmlhelp.com/reference/html40/forms/form.html
Also, when a file is uploaded you cannot use the regular methods to get at the name/value pairs or the file itself. You'll have to use a utility like MultiPartRequest or write your own based on the RFC for Multipart requests.
http://www.servlets.com/cos/javadoc/com/oreilly/servlet/MultipartRequest.html
You will need some temporary file system to store this and then delete it when you are done with it.
hth

Similar Messages

  • How to read the file from a folder.

    Hi All,
    How to read the file from a folder or directory from the non sap server / remote server.
    Regards
    Sathis

    open dataset filename for input in text mode
                         encoding default.
    filename is character type variable with the destination filename.
    Edited by: Jino Augustine on Apr 19, 2010 1:31 PM

  • How to read multi files?

    Hi !! Can anyone tell me the syntax of reading mulit txt files? Thanks. I only know how to read single file.
    try
    //Search file
    System.out.println(" ");
    System.out.println("Search file :");
    File file = null;
    String fileloc = "c:\\j2sdk1.4.1_06\\bin\\PAYMENT.TXT";
    file = new File(fileloc);
    //If Payment interface file exists
    if (file.exists()) {
    System.out.println("File exists !");
    System.out.println("");
    }

    Hi!! How to read multi files (For example: dbExport1.txt , dbExport2.txt , dbExport3.txt ...... => dbExport*.txt) ?
    I only know how to read a single file.
    try
         Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
         conn = DriverManager.getConnection(url, userid, password);
    stmt = conn.createStatement();
         if (conn != null)
         System.out.println("Connection to Database OK!");
    // read it
    BufferedReader br = new BufferedReader(new FileReader("c:\\document\\dbExport.txt"));
    DataInputStream in = new DataInputStream(new FileInputStream("c:\\document\\dbExport.txt"));
    String input;
    String firstinput;
    String secondinput;
    int count=130;
    int year=1955;
    while ((input = br.readLine()) != null) {
    firstinput = input.substring(0, 10);
    secondinput = input.substring(10);
    count = count + 1;
    System.out.println(firstinput);
    System.out.println(secondinput);
    String insertStore1 = ("INSERT INTO AUTHORS " +
    "VALUES ('" + count + "', '" + firstinput + "', '" + secondinput + "', 1955)");
         System.out.println(insertStore1);
    boolean result;
    if (stmt.executeUpdate(insertStore1) == 1){
    System.out.println("Insertion successful");
    else{
    System.out.println("Insertion failed");
    br.close();
         stmt.close();
         conn.close();
    }

  • How to read WSDL File

    Hi all,
    I am new in web services...just started yesterday.. my client is provinding web services...I just need to send some data to them and retrieve data back...they are basically verifying addresses..if Address is not corrent then they will send the correct one back..I have no clue which method should I call and how to send data to them..below is my work that I have done so far...please help me...
    ///Below is the Client API that I have made...there is a bean file which I have made for Input Data...
    import org.apache.axis.client.Call;
    import org.apache.axis.client.Service;
    import javax.xml.namespace.QName;
    public class TestClient {
        public static void main(String [] args) {
           try {
             String endpoint = "http://m3group101.mnao.net:8080/jboss-net/services/ValidateAddress";
             Service  service = new Service();
             Call     call    = (Call) service.createCall();
            call.setTargetEndpointAddress( new java.net.URL(endpoint) );
            call.setOperationName(new QName("http://m3group101.mnao.net/", "ValidateAddress"));
         call.setUsername("free");
         call.setPassword("account");       
         AddressIn addressIn  = new AddressIn();
            addressIn.Address1 = "6767 Friars Rd";
            addressIn.Address2 = "";
            addressIn.Address3 = "";
            addressIn.Address4 = "";
            addressIn.City = "SAN DIEGO";
            addressIn.StateProv = "CA";
            addressIn.PostalCode = "";
            addressIn.Country = "US";
            String ret = (String) call.invoke(new Object[] {"",""});      ////Here I donno what should I pass
            System.out.println("Sent DATA, got '" + ret + "'");
          } catch (Exception e) {
            System.err.println("Got Error While retrieving data "+e.toString());
    ///My Bean File Looks like this....
    import java.io.*;
    import java.util.*;
    import java.util.ResourceBundle;
    public class AddressIn {
        public String KeyValue;
        public String Address1;
        public String Address2;
        public String Address3;
        public String Address4;
        public String City;
        public String StateProv;
        public String PostalCode;
        public String Country;
        public AddressIn()
             KeyValue   = "";
             Address1   = "";
             Address2   = "";
             Address3   = "";
             Address4   = "";
             City       = "";
             StateProv  = "";
             PostalCode = "";
             Country    = "";
        } // END constructor
    } // END class AddressIn
    import java.io.*;
    import java.util.*;
    import java.util.ResourceBundle;
    public class AddressOut {
        public String KeyValue;
        public String Address1;
        public String Address2;
        public String Address3;
        public String Address4;
        public String City;
        public String StateProv;
        public String PostalCodeBase;
        public String PostalCodeAddOn;
        public String Country;
        public String Status;
        public String StatusCode;
        public String StatusDescription;
        public String Confidence;
        public String RecordType;
        public AddressOut()
             KeyValue   = "";
             Address1   = "";
             Address2   = "";
             Address3   = "";
             Address4   = "";
             City       = "";
             StateProv  = "";
             PostalCodeBase  = "";
             PostalCodeAddOn = "";
             Country    = "";
             Status     = "";
             StatusCode = "";
             StatusDescription = "";
             Confidence = "";
             RecordType = "";
        } // END constructor
    } // END class AddressInPlease see the WSDL File...
    <?xml version="1.0" encoding="UTF-8" ?>
    - <wsdl:definitions targetNamespace="http://m3group101.mnao.net:8080/jboss-net/services/ValidateAddress" xmlns="http://schemas.xmlsoap.org/wsdl/" xmlns:apachesoap="http://xml.apache.org/xml-soap" xmlns:impl="http://m3group101.mnao.net:8080/jboss-net/services/ValidateAddress" xmlns:intf="http://m3group101.mnao.net:8080/jboss-net/services/ValidateAddress" xmlns:soapenc="http://schemas.xmlsoap.org/soap/encoding/" xmlns:tns1="http://com.g1.dcg/services" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" xmlns:wsdlsoap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsd00="http://www.w3.org/2000/10/XMLSchema" xmlns:xsd99="http://www.w3.org/1999/XMLSchema">
    - <wsdl:types>
    - <schema targetNamespace="http://m3group101.mnao.net:8080/jboss-net/services/ValidateAddress" xmlns="http://www.w3.org/2001/XMLSchema">
      <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
    - <complexType name="ArrayOf_xsd_anyType">
    - <complexContent>
    - <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:anyType[]" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />
      </restriction>
      </complexContent>
      </complexType>
    - <complexType name="ArrayOf_tns1_ServiceOption">
    - <complexContent>
    - <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType" wsdl:arrayType="tns1:ServiceOption[]" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />
      </restriction>
      </complexContent>
      </complexType>
    - <complexType name="ArrayOf_tns1_DataRow">
    - <complexContent>
    - <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType" wsdl:arrayType="tns1:DataRow[]" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />
      </restriction>
      </complexContent>
      </complexType>
    - <complexType name="ArrayOf_xsd_string">
    - <complexContent>
    - <restriction base="soapenc:Array">
      <attribute ref="soapenc:arrayType" wsdl:arrayType="xsd:string[]" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" />
      </restriction>
      </complexContent>
      </complexType>
      </schema>
    - <schema targetNamespace="http://com.g1.dcg/services" xmlns="http://www.w3.org/2001/XMLSchema">
      <import namespace="http://schemas.xmlsoap.org/soap/encoding/" />
    - <complexType name="ServiceOption">
    - <sequence>
      <element name="key" nillable="true" type="xsd:string" />
      <element name="value" nillable="true" type="xsd:string" />
      </sequence>
      </complexType>
    - <complexType name="DataTableBean">
    - <sequence>
      <element name="columnNames" nillable="false" type="impl:ArrayOf_xsd_string" />
      <element name="dataRows" nillable="true" type="impl:ArrayOf_tns1_DataRow" />
      </sequence>
      </complexType>
    - <complexType name="DataRow">
    - <sequence>
      <element name="values" nillable="true" type="impl:ArrayOf_xsd_string" />
      </sequence>
      </complexType>
      </schema>
      </wsdl:types>
    - <wsdl:message name="processResponse">
      <wsdl:part name="arg0" type="tns1:DataTableBean" />
      </wsdl:message>
    - <wsdl:message name="processRequest">
      <wsdl:part name="arg0" type="impl:ArrayOf_tns1_ServiceOption" />
      <wsdl:part name="arg1" type="tns1:DataTableBean" />
      </wsdl:message>
    - <wsdl:portType name="G1Service">
    - <wsdl:operation name="process" parameterOrder="arg0 arg1">
      <wsdl:input message="impl:processRequest" name="processRequest" />
      <wsdl:output message="impl:processResponse" name="processResponse" />
      </wsdl:operation>
      </wsdl:portType>
    - <wsdl:binding name="ValidateAddressSoapBinding" type="impl:G1Service">
      <wsdlsoap:binding style="rpc" transport="http://schemas.xmlsoap.org/soap/http" />
    - <wsdl:operation name="process">
      <wsdlsoap:operation soapAction="ValidateAddress" />
    - <wsdl:input name="processRequest">
      <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://m3group101.mnao.net:8080/jboss-net/services/ValidateAddress" use="encoded" />
      </wsdl:input>
    - <wsdl:output name="processResponse">
      <wsdlsoap:body encodingStyle="http://schemas.xmlsoap.org/soap/encoding/" namespace="http://m3group101.mnao.net:8080/jboss-net/services/ValidateAddress" use="encoded" />
      </wsdl:output>
      </wsdl:operation>
      </wsdl:binding>
    - <wsdl:service name="ValidateAddress">
    - <wsdl:port binding="impl:ValidateAddressSoapBinding" name="ValidateAddress">
      <wsdlsoap:address location="http://m3group101.mnao.net:8080/jboss-net/services/ValidateAddress" />
      </wsdl:port>
      </wsdl:service>
      </wsdl:definitions>I am receiving Exception " No Such Operation "
    I am sorry but I don'n know how to read WSDL file...
    thanks
    Vish...
    Message was edited by:
    vishu007

    Start going through the tutorials that come with Axis (you didn't state which version of Axis you're using btw, and there are major differences between them).
    Anyway, the wsdl you list doesn't have an operation called "ValidateAddress". It has only one operation, called "process".
    The call takes 2 arguments, as defined in the input message, and returns one value as defined in the output message.
    Had you used Axis to generate your classes for you that would all have become quite obvious.

  • How to read .xml file from embedded .swf(flash output) in captivate

    I have been trying to read .xml file from the .swf (Flash output) that is embedded within the captivate file but no luck yet . Please if anyone got any clue on how get this thing done using Action script 3.0 then let me know. I am using Adobe Captivate 5.5 at present and Flash CS 5.5.
    I am well aware about how to read .xml file through action script 3.0 in flash but when insert the same flash in captivate and publish nothing comes in captivate output. I would higly appreciate if anyone could help me out with that.
    Here is is graphical demonstration of my query :
    Message was edited by: captainmkv

    Hi Captainmkv,
    Does the information in this post cover what you're trying to do: http://forums.adobe.com/message/5081928#5081928
    Tristan,

  • How To Read RTF file in JAVA?  Using  iText?

    How To Read RTF file in JAVA?  Using  iText?.....
    import java.io.*;
    import com.lowagie.text.*;
    import com.lowagie.text.rtf.*;
    public class RTF3 {
    public static void main(String[] args) {
    // System.out.println("This example generate a RTF file name Sample.rtf");
    // Create Document object
    Document myDoc = new Document();
    try {
    // Create writer to listen document object
    // and directs RTF Stream to the file Sample.rtf
    RtfWriter2.getInstance(myDoc, new FileOutputStream("Sample.rtf"));
    // open the document object
    myDoc.open();
    // Create a paragraph
         Paragraph p = new Paragraph();
         p.add("Helloworld in Rtf file..amazing isn't");
         // Add the paragraph to document object
    myDoc.add(p);
    catch(Exception e) {
    System.out.println(e);
    //close the document
    myDoc.close();
    Exception in thread "main" java.lang.NoSuchMethodError: com.lowagie.text.Rectangle.width()F
         at com.lowagie.text.rtf.document.RtfPageSetting.rectEquals(RtfPageSetting.java:433)
         at com.lowagie.text.rtf.document.RtfPageSetting.guessFormat(RtfPageSetting.java:362)
         at com.lowagie.text.rtf.document.RtfPageSetting.setPageSize(RtfPageSetting.java:341)
         at com.lowagie.text.rtf.RtfWriter2.setPageSize(RtfWriter2.java:248)
         at com.lowagie.text.Document.open(Unknown Source)
         at view.RTF3.main(RTF3.java:23)
    CAN you HELP me?

    import com.lowagie.text.Document;
    import com.lowagie.text.rtf.parser.RtfParser;
    import java.io.FileInputStream;
    String inputFile = "sample.rtf";
    Document document = new Document();
    document.open();
    RtfParser parser = new RtfParser(null);
    parser.convertRtfDocument(new FileInputStream(inputFile), document);

  • How to read the files in different directories

    how to read the files in different directories here directory names will change dynamically under root node.
    let me say
    rootnode---->subnode1
    >subnode2
    >subnode3
    >subnode n
    how to specify these in file adapter.

    Hi
    look at this thread your problem is solved here
    File Adapter
    Regards
    Abhishek
    Edited by: Abhishek Agrahari on Dec 16, 2008 11:37 AM

  • How to read pdf file using file adapter

    Hi..
        How to read pdf file using file adapter?
    regards
    Arun

    Hi
    This may help you
    /people/sap.user72/blog/2005/07/27/xi-generate-pdf-file-out-of-file-adapter
    /people/alessandro.guarneri/blog/2007/02/21/sap-xi-acting-as-a-huge-file-mover
    ---Ram

  • How 2 read two files from 2 diff. directories, using single adapter

    How 2 read two files from 2 diff. directories in same system, using single file adapter.

    you can use advanced selection for source file
    see
    http://help.sap.com/saphelp_nw04/helpdata/en/e3/94007075cae04f930cc4c034e411e1/frameset.htm

  • How to read xml file as shown below.

    Hello,
    I am using flash builder 4 and currently working on implementing AIR application.
    I need to read xml file data.
    Normal xml files are easy to read and i am much more aware of it.
    But can any one have idea how to read XML file which is given below.
    <node>
    <key>ID</key>
    <integer>1</integer>
    <key>Name</key>
    <string>Dhwani</string>
    <key>Postno</key>
    <integer>20</integer>
    <key>deskname</key>
    <string>flex</string>
    <key>empid</key>
    <integer>25</integer>
    <key>projectname</key>
    <string>abc</string>
    </node>
    Here i have xml file in form of key value pair. <key> node shows name of the key and after that <integer> or <string> node are the value for that specific key.
    if i select node.key then it shows me all the keys. and from that i cant make out what is the value for key ID.
    Is there any way to take first node and then second. i mean first i ll take value of key and store it into some arraycollection. and then value will be stored.
    Any help is appreciated.. Looking for positive reply.
    Thanks
    Dhwani

    There are different methods to access XML data which have pro's and cons. Let us know more about what you want to do and we can help you.

  • How to read XML file and write into another XML file

    Hi all, I am new to JAVAXML.
    My problem is I have to read one XML file and take some Nodes from that and write these nodes into another XML file...
    I solved, how to read XML file
    But I don't know how to Write nodes into another XML.
    Can anyone help in this???
    Thanks in advance..

    This was answered a bit ago. There was a thread called "XML Mergine" that started on Sept 14th. It has a lot of information about what it takes to copy nodes from one XML Document object into another.
    Dave Patterson

  • How to read XML file and update the data in MS CRM 2011?

    Hi Folks,
    Can anyone please help me finding some references to read XML files and push the data to MS CRM 2011 preferably by using a console application.
    Please let me know if any ways of handling it in simple ways.
    Thanks,
    Sri

    HI,
    How to read XML file:
    https://social.msdn.microsoft.com/Forums/en-US/5dd7261b-86c4-4ca8-ba87-95196ef3ba50/need-to-display-xml-file-in-textboxes-edit-the-data-and-save-the-new-xml-file?forum=csharpgeneral
    How to work with CRM:
    ClientCredentials credentials = new ClientCredentials();
    credentials.Windows.ClientCredential = new System.Net.NetworkCredential("USER", "Password", "Domain");
    Uri uri = new Uri("http://server/Organization/XRMServices/2011/Organization.svc");
    OrganizationServiceProxy proxy = new OrganizationServiceProxy(uri, null, credentials, null);
    proxy.ServiceConfiguration.CurrentServiceEndpoint.Behaviors.Add(new ProxyTypesBehavior());
    IOrganizationService service = (IOrganizationService)proxy;
    //using "service" you can create, update and retrieve entities.
    More information here about service functions:
    https://msdn.microsoft.com/en-us/library/gg328198.aspx

  • How to read PDF files on your iphone in book format

    Hey everyone, I just posted a tutorial on how to read pdf files like ebooks on Stanza. Let me know if you have any questions
    http://budurl.com/u4tz
    That used to drive me crazy until I figured it out. Enjoy

    an easier way would be to wait until iOS 4 and then download the free iBooks app... you can import via the file sharing feature in iTunes (same that the iPad uses), or open the file from an email using the "open in" feature currently found on the iPad...
    http://www.apple.com/iphone/features/mail.html
    ^ scroll down to the iphone with the subheading underneath saying "See what’s attached."

  • How to read .asl files?

    I'm working on an iMac, OS 10.5.8. My log folder is full of asl files. I'm not a program-savvy person and need plain language. I've gotten as far as to put the many log files into a temp folder on my desktop. Now I see instructions to "read them at my leisure" but can't find out how to read these files to determine what's causing the rapid multiplication. How do I "read" these logs to determine where the problem lies?

    -Correction, in your Log folder, under Private/var/log/asl ; asl files are not associated with photoshop, they are Apple System Logs.
    -I also have runaway (asl) files on my 10.5.8 Imac. Some are 80 gig +/-. and it fills my hard-drive. I got a program called Disk Inventory X that helped me graphically find these huge files. That way I can see them, right click on them and reveal them in a finder screen.
    -After locating the offending files, if you right click the .asl file and say open with the utility "console" you can view the logs.
    -Look for lines that repeat ludicrous times, then try to figure it out.
    -I am no expert, but apparently I just found out my problem might be apple.launchd keeps trying to contact com.rim.BBLaunchAgent. I haven't owned a Blackberry for a few years now and already uninstalled their Desktop Manager, but some program remnant seems to be haunting my computer.
    -If I determine the asl file(s) are unimportant, I delete them after entering my password. You have to then empty your trash to really free up hard-drive space.
    -Good luck with your hunt.

  • How to read pmd files on mac?

    How to read pmd files on mac?

    There is no native support to open PageMaker documents on the Mac. I would check to see what PageMaker document versions that InDesign CS6 can open, ether on Mac or PC.
    Adobe still has the trial of PageMaker 7 for Windows (Adobe link) and PM7 PDF, which you could install in Boot Camp, or Mac Virtual Machine in Windows 7.
    I just checked the latest release of LibreOffice, and there is no support for PageMaker anything.
    zamzar dot com does not support .pmd content.

Maybe you are looking for

  • Please help with a weird issue

    Hi all, I'll try and be brief here but i need to give a lot of info, so please bear with me and thanx a lot for reading... I Have just bought a K7N2 Delta MB, AMD Athlon 2800 XP (Barton Core), 120GB Western Digital HD, Sony DVD Writer, 2 x Corsair 25

  • User migration vom SAP DB to LDAP: Problem when userId not equal to logonId

    Hello I have to write a migration tool which migrates the users stored in the SAP DB to LDAP. Thereby the logon ID of the users in the SAP DB is not equal to the user ID. The migration works fine and in SAP Identity Management (IDM) everything is ok.

  • Hp dv7 dies need to removed and power disconnected to re start but it stats up s a full crash in dos

    hp dv7 with new Factory HP battery , when crashes it needs battery to be removed and power diconnected to re start but it stats up into a full crash in dos asking what type of starup is required Please advise clive

  • Qosmio G30 - No sound

    This may have been answered before but I've lost sound on my Q30. There's no volume control. I've re-installed the SigmaTel High Definition Audio Codec which Device Manager then reports as working correctly. All the other audio drivers seem to be ins

  • Formatted Data Labels in CFCHART

    Is there a way to format data values in CFCHART? All my values in database are stored as 99.9 See below). These are percentages that I need to display on a bar chart. Everything works fine except when displaying 76.0, it shows as 76. All other values