How to read the contents of the Uploaded file ?

hi @,
I have used the File upload and Download UI elements as per the tutorial available. Now my requirement is to read the contents of the file and transfer it to the Backend system.
How can I achieve the desired fucntionality.
Thanks in advance,
Regards,
Amit

try this code to store image file in back end system.
IWDResource res=wdContext.currentMyDataElement().getPictureres();
          InputStream in=res.read(false);
          ByteArrayOutputStream bout=new ByteArrayOutputStream();
          int length;
          byte[] part=new byte[10*1024];
          while((length=in.read(part))!=-1)
          bout.write(part,0,length);
          in.close();
pstmt.setBytes(8,bout.toByteArray());
If it is other than image file like word or text then try this in action
IWDResource resource = wdContext.currentResElement().getResorce(); // your existing handle to the upload resource type
            try {
               InputStream stream = resource.read(true);
               byte b[]= new byte[1000];
               stream.read(b);
               String str = new String(b);
               int i=str.length();
               wdContext.currentContextElement().setOut(str);
               wdContext.currentContextElement().setSize(i);
               wdContext.currentResElement().setResourceurl(
                    wdContext.currentResElement().getResorce().getUrl(WDFileDownloadBehaviour.OPEN_INPLACE.ordinal()));
          } catch (IOException e) {
               // TODO Auto-generated catch block
               e.printStackTrace();
The in back end field where u store the file should be byte array.
Regards,
H.V.Swathi

Similar Messages

  • How to get the content of the uploaded file.

    Hi Experts,
    I am using a input box to get the path of the file to be uploaded.(I am not using FILE UPLOAD UI Element).Could you please let me know how to get the content of the uploaded file.
    Regards,
    Arun

    >
    ARUN KUMAR.S wrote:
    > Hi Experts,
    >
    > I am using a input box to get the path of the file to be uploaded.(I am not using FILE UPLOAD UI Element).Could you please let me know how to get the content of the uploaded file.
    >
    > Regards,
    > Arun
    You will not be able to use a normal InputField to upload file contents.  This is not allowed by the browser security model. You must use one of the upload specific UI mechanisms - the FileUpload UI element or as of 7.01 ACFUpDownload or FlashIslands.

  • URGENT: How to read the content of a PDF-file in Java?

    Hello
    What I need are some classes which can read a pdf and translate it in normal Text, so that I can write the content of the pdf in my database.
    Where can I find those classes? Or how else could I get there?

    www.lowagie.com/itext
    www.etymon.com/pj
    www.retep.org.uk/pdf
    www.pdflib.comwww.pdfzone.com
    www.planetpdf.com
    www.purepdf.com
    www.adobe.com
    www.pdfstore.com
    www.adobe.com/proindex/acrobat/formsresources.html
    www.partners.adobe.com/asn/developer/acrosdk/forms.html
    www.rrsys.com
    www.javafoundry.com/javapdf
    www.novagraphix.com/internet_publishing_with_acrobat/forms/forms_tutorial.html
    www.binarything.com

  • How to read the content of a text file (by character)?

    Guys,
    Good day!
    I'm back just need again your help. Is there anyone knows how to read the content of a text file not by line but by character.
    Please help me. Thank you so much in advance.
    Jojo

    http://java.sun.com/javase/6/docs/api/index.html
    package java.io
    InputStream.read(): int
    Reads the next byte of data from the input stream.
    Implementation:
    InputStreamReader
    An InputStreamReader is a bridge from byte streams to character streams: It reads bytes and decodes them into characters using a specified charset. The charset that it uses may be specified by name or may be given explicitly, or the platform's default charset may be accepted.

  • Help on how to read the content of an XML file from the payload

    I have a receiver channel / mail adapter, that sends e-mails with a XML attachment.
    I’m trying to write a Bean, that should make it possible to rename the attached XML file dynamically.
    In the Bean I want to read the content of the attached XML file, it could be the “order number”.
    The filename should then be “Order number”.XML.
    <u><i>Can anyone help me with how to read the content of the XML file from the payload.</i></u>
    <i><b>Frank</b></i>

    hi,
    check this: http://jakarta.apache.org/poi/

  • How to read the content of this excel file in LV

    Hi could you please let me know how can I read the content of this excel file using the Read From Speardsheet function. It contains text and numbers
    Thanks
    The excel file is attached
    Attachments:
    Datalogging.zip ‏307 KB

    Check attached VI.
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.
    Attachments:
    ReadFromExcel.vi ‏27 KB

  • How to read the content of ms-word file use pure java???

    how to read the content of ms-word file use pure java???

    hi,
    check this: http://jakarta.apache.org/poi/

  • "iTunes cannot read the contents of the ipod", How can I fix this?

    Hello everyone, I am having trouble with my iPod touch 32GB and getting iTunes to detect it. I'm using Windows 7.
    When plugging it in tonight, I got the message "iTunes cannot read the contents of the iPod (Name). Go to the summary tab in the iPod preferences and click restore to restore this iPod to factory settings". I attemped to do this, but I then got an iTunes error "3184" and was unable to install the iPod software.
    I've tried...
    - Using a different computer
    - Using a different USB cable
    - Rebooting the iPod
    Nothing seems to work. I've read a solution as to delete one of the iTunes files on the iPod, but the iPod doesn't show up in my Windows Explorer, so I am unable to do this. The computer does however charge the battery when I have the iPod plugged in. I'm also able to still listen to music on the iPod as well.
    One other note, I had the same thing happen to my previous iPod touch. I got my original iPod touch back in December 2010. In October 2011, the iPod just died one day and I was not able to turn it on at all or charge it. When I'd plug it into the computer, I got the exact same errors and was unable to restore the iPod. I sent it in to Apple as it was still under warrenty and they sent me a replacement. Now 3 months later it's happened again. Of course the warrenty starts from the day you purchase the original, so this is no longer under warrenty despite having it for only 3 months. The only difference this time is that the battery still charges and I can still turn it on and listen to music.
    Any ideas?
    Thanks

    hi Angie!
    hmmm. is there an Apple Store convenient where you can take the ipod for a check-up?
    love, b

  • How to read the contents in the excel file on the basis of colunm heading?

    Hi,
    Here is my requirement like that  in excel file i got the customer number , amount etc....
    And my required fields are customer and amount. In file customer nr is under the heading 'CUSTOMER' and amount is under the heading 'AMOUNT'.
    Is there any FM for reading the contents under the colunm heading of excel?
    Please suggest me.
    Thanks,
    Harshal kulkarni

    Hi Harshal ,
    I dont think there is such function module /BAPI/Class-Method .
    but if your excel file is dynamic you can write your own logic using field - symbols.
    Regards ,
    Praveen

  • Issue in reading the contents of the file

    Hi all,
            How to read the contents of a text file and assign it to a single context variable and sent it to database I am using File upload control to upload the file. Up to my thing file upload control will give us the path of the file. We need to get the url and read it from it. If i am wrong please correct me and give suggestion to solve this.
    Thanks in advance.

    On UPLOAD click do this:
      public void onActionLoadFile(com.sap.tc.webdynpro.progmodel.api.IWDCustomEvent wdEvent )
        //@@begin onActionLoadFile(ServerEvent)
         WDWebResourceType FileType = null;
         String FileName = new String();
              //get attribute info for context attribute 'FileUpload'
              IWDAttributeInfo attributeInfo =
                   wdContext.getNodeInfo().getAttribute(
                        IPrivateEmailView.IContextElement.FILE_UPLOAD);
              //get modifiable binary type from the attribute info,requires type cast.
              IWDModifiableBinaryType binaryType =
                   (IWDModifiableBinaryType) attributeInfo.getModifiableSimpleType();
              IPrivateEmailView.IContextElement element =
                   wdContext.currentContextElement();
              //if a file in the 'FileResource' attribute exists
              if (element.getFileUpload() != null) {
                   try {
                        String mimeType = binaryType.getMimeType().toString();
                        byte[] file = element.getFileUpload();
                        //get the size of the uploaded file
                        element.setFileSize(this.getFileSize(file));
                        //get the extension of the uploaded file
                        element.setFileExtension(binaryType.getMimeType().getFileExtension());
                        //NOTE: context attribute 'FileName' must not be set
                        //because the FileUpload-UI-element property 'fileName'
                        //is bound to it. Consequently the fileName is automatically
                        //written to the context after file upload.
                        //report success message
                        wdComponentAPI.getMessageManager().reportMessage(
                        IMessageEmailComp.SF_UPLOAD,
                             new Object[] { binaryType.getFileName()},
                             false);
                        FileType = binaryType.getMimeType();
                        FileName = binaryType.getFileName();
                   } catch (Exception e) {
                        throw new WDRuntimeException(e);
              //if no file in the 'FileResource' attribute exists
              else {
                   //report error message
                   IWDMessageManager msgMgr = wdComponentAPI.getMessageManager();
                   msgMgr.reportContextAttributeMessage(
                        element,
                        attributeInfo,
                        IMessageEmailComp.NO_FILE,
                        new Object[] { "" },
                        true);
              //clear the FileResource context value attribute
              //element.setFileUpload(null);
              String URL;
              URL = this.CreateAndGetPathFileUpload(
                                  wdContext.currentContextElement().getFileUpload(),
                                                      FileName);
    //          if (URL.length() == 1){
    //               //ERROR
         wdContext.currentContextElement().setPATHFileUploaded(URL);
        //@@end
      private String CreateAndGetPathFileUpload(byte[] FileUpload, String FileName){
           String URL = new String();
         try {
              FileOutputStream fos = new FileOutputStream(FileName);
              fos.write(FileUpload);
              fos.close();
         } catch (FileNotFoundException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
         } catch (IOException e) {
              // TODO Auto-generated catch block
              e.printStackTrace();
         File fl = new File(FileName);
         URL = fl.getAbsolutePath();
           return URL;
    Forgot the method that give you the URL file.
    Message was edited by: Roberto Tagliento

  • I have 5 html pages that share a common header, footer, and sidebar. how do i use my nav bar to change the content of the body without duplicating a lot of code?

    i have 5 html pages that share a common header, footer, and sidebar. how do i use my nav bar to change the content of the body without duplicating a lot of code? thank you!

    i inherited the website. It’s for a non-profit and is not very
    sophisticated, and neither am I in webdesign. It currently has multiple
    pages that are identical except for that body section, so whenever i change
    the navigation (in the sidebar) I have to update every html page.  I want
    to have one basic page, and just call in the different body content based
    on the link the user selects from the nav bar. How can i do that using a
    script? i am using Dreamweaver.
    ~ in love and light ~
    Jeannie
    On Sat, Feb 7, 2015 at 4:07 AM, Ben Pleysier <[email protected]>

  • Hi, I have a new cell phone, I wanted to give my iphone to my father, instead of deleting the content on the iphone I have deleted the entire iphone. It starts up no more. iTunes will not recognize the iphone. How do I get my old data back onto the phone?

    Hi, I have a new cell phone, I wanted to give my iphone to my father, instead of deleting the content on the iphone I have deleted the entire iphone. It starts up no more. iTunes will not recognize the iphone. How do I get my old data back onto the phone?

    Place the device in DFU mode (google it) and restore as new.

  • How to import and make the content of the original PDF document editable and preserves the pdf appearance and retains existing fields and formatting in LiveCycle

    Can someone tell me how I can see my content (artwork and text) after I import  it into LiveCycle Designer ES4?  I like to import and make the content of the original PDF document editable; preserves the pdf appearance and retains existing fields and formatting, then allow me to do the modifications and save it back into the original PDF document with changes. I have tried everything but still cannot see my content(artwork and Text) of my original PDF after importing it into LiveCycle. All I see are is a blank page with the formatting and layout of where my artwork and text should be. I like to see everything if possible so after I make my change I will know how it will look when I save it back into the PDF and open it in Acrobat Reader.

    Can someone tell me how I can see my content (artwork and text) after I import  it into LiveCycle Designer ES4?  I like to import and make the content of the original PDF document editable; preserves the pdf appearance and retains existing fields and formatting, then allow me to do the modifications and save it back into the original PDF document with changes. I have tried everything but still cannot see my content(artwork and Text) of my original PDF after importing it into LiveCycle. All I see are is a blank page with the formatting and layout of where my artwork and text should be. I like to see everything if possible so after I make my change I will know how it will look when I save it back into the PDF and open it in Acrobat Reader.

  • How to create a jar having the contents of the jar in a byte array?

    Hi,
    I have a server and client application. My server returns the contents of the jar in the form of byte array to the client on a particluar method call. Now at the client end, i want to reconstruct the jar to be used. How do I do this?
    The server uses the JarInputStream to read the contents of the jar to be returned. I have tried using the JarOutputStream, but looks like this works fine if we have spearate class files to be added to the jar. Now that I have the contents of the jar itself, how do i recreate the jar?
    Can anyone please help me with this?
    Thanks
    Rajani

    Have you ever gotten the raw byte copy to work? If so, how?
    I download a jar via InputStream and save into a jar file via fileoutputstream. It always gets corrupted in the process. The new Jar file has the exact same number of bytes, but doesn't get past the Manifest on a -tvf. In fact, Winzip can open it fine, but can't extract. So close...yet so far.
    Here is a snapshot of my code:
    BufferedInputStream data1=new BufferedInputStream(con.getInputStream());
    DataInputStream data=new DataInputStream(data1);
    StringBuffer buf=new StringBuffer();
    try{
    while((theChar=data.read()) != -1)
    { buf.append((char)theChar); }
    } catch (Exception z){ logger.info("UpdateThread.read Done Reading jar file");}
    data.close();
    File newFile = new File("C:/MyJar.jar");
    FileOutputStream outstream2 = new FileOutputStream(newFile);
    DataOutputStream outstream1 = new DataOutputStream(outstream2);
    BufferedOutputStream outstream = new BufferedOutputStream(outstream1);
    byte [] bytes = buf.toString().getBytes();
    logger.info("Bytes of new Jar file = " + bytes.length);
    int i;
    for(i=0;i<bytes.length;i++){
    outstream.write(bytes);
    outstream1.close();
    outstream.close();
    Any ideas where I'm going wrong?

  • Can a search engine read the contents of a Library file embedded in a page?

    Can a search engine read the contents of a Library file
    embedded in a page? Or would SSI be the way to go. I'm creating a
    large library of text-based information and links, and I want to
    have much of it modular so I can add a link and all the many pages
    on my site updates to reflect the change. A big concern is that
    when a search engine visits my site, can it read the content
    embedded in the library item, or is SSI a better method to help the
    search engine read my content?
    Thanks

    Yes, search engines can read Dreamweaver library items. The
    library only exists on your own hard drive. Once you add the
    library item to your pages it's in there as regular HTML.
    If you have more than 20 pages on your site, they say SSI is
    better, because when you update you only update the SSI. If you
    stick with library items each page has to be uploaded every time
    the library is updated.

Maybe you are looking for

  • My Macbook Pro can't find any of my files!

    Hi there, Since yesterday, my Mac suddenly can't find any of my files anymore. All the folders are there, but all the files are missing. There are 2 big question marks on the top of the finder window and when I click on them it says that files cannot

  • Airport Express disconnects wired internet connection when attempting to extend Airport Extreme WiFi network

    I just purchased and airport express to extend my wifi network.  My base station is an airport extreme, I have one wired connection and a wifi network.  When I go through the recommended steps to set up the express and "extend the network", the airpo

  • Error 1336 when I install or uninstall NI Labview related files.

    The error message is: "Installer Error There was an error creating a temporary file that is needed to complete the installation" My IT guys found that the installer is trying to create a temporary file for a Mozilla plug-in. WHY IS IS IT NECECCASY TO

  • How to achieve this table in biee?

    !http://farm4.static.flickr.com/3443/3406243100_b60e73cfcc_m.jpg! as image show! How can I achieve this table in biee?I just know sum_level1 and sum_level2 can auto generate by biee,but what about rule1 and rule2,is there any way achieve them? Anyone

  • HTTP message lands up in Adapter Engine

    Hi All I must be missing something basic here - We have a synchronous HTTP->XI->BW scenario. The message exchange seems to be fine as we can see the response back from BW. The problem is that when we look at SXMB_MONI(SXI_MONITOR) for the message we