Display file contents

Hi, I am learning servlets, and am trying to write my own simple upload program.
I'm trying to see first whether my code can pick up the contents of the file the user specifies. The form is set to multipart/form-data and uses POST.
Right now I'm using ServletInputStream to print out the information submitted in the request, but instead of printing out the contents of the file, it prints out all the POST parameters, including the file name parameter. It is only the file, theigh, and I want the contents of the file to also be displayed.
Can anybody please help me by describing what I could do to output the contents? Does another type of stream need to be opened to start looking at the file's contents, in addition to just looking at the POST headers and parameters?
Thanks.

Hi Sudhir,
I found an example which does similar to what you are looking for. Unzip the zipped file and you should see two examples.
File Read Customized will help you to read data from file and format into single column.
File Read Customized_multiple line will help you to read data from a file which has multiple rows and columns. Then it updates table on the front panel with new line read.
Please feel free to use it. I am also attaching a sample text file for you to try the example.
Kalyan
Kalyanramu Vemishetty
Automated Test Systems Engineer
National Instruments
Attachments:
example.zip ‏25 KB

Similar Messages

  • How to display file contents on a web page

    On unix platform I have created a class that can read the contents of a file and display them to the standard output. But now i want to display these file contents on a web page through jsp. On JSP code I have imported this class and want to assign a record from a file and write it to the screen using html. I think the class needs to be modified in order to return the string record read from a file so that im able to access it from a jsp and assign it to a variable the I can display it on the screen. Can someone help me with these code?

    Actually, you mean Linksys.  BIG difference there.
    Linksys Business Series was accumulated into Cisco Small Business, since it was purpose built for small business, not residential/consumer grade.
    The new PVC2300 actually are Cisco branded on the case.
    The collateral you seek is protected by the business unit that supplies it, since it was placed on a portal that only Cisco registered partners can access.
    As I wrote, I already checked with the BU and they told me thats where it lives and not to hand it out.  I cannot override that. 
    I am not sure there are any secrets in there, but I dont make the rules, sorry.
    Do you want to be a Cisco Partner?   Sign up and gain access to everything you need to sell Cisco successfully to end customers?  If you tell me your geography (city/state/zip, I will have an ICAM call you and help recruit you.....
    Steve D
    Systems Engineer
    U.S. Partner Sales team
    RTP, N.C.

  • Display file content in Web Dynpro ABAP

    Hello,
    we would like to be able to display any file after having uploaded files using FileUpload ui  element in a web dynpro abap application.
    for microsoft word excel files, the OfficeControl ui element can be used and for  pdf documents the InteractiveForm ui element can be used.
    for other formats  such as '.tif', '.jpg', '.txt'..... we did not find out how to be able to display the file contents
    Does anybody know if and how this could be achieved?
    Cheers
    Ana

    Chris,
    You may be right. Also it requires some configuration in SAP KPro ( document class etc).
    Please see SAP [Help |http://help.sap.com/printdocu/core/print46c/en/data/pdf/BCSRVBDS/BDS_STRUCTURE.pdf]on Business Document Services.
    At page 64 of this document under topic 'Display Documents' 'Feature it says. "If it is not possible to display the document in place, an appropriate viewer that is available on the
    PC is started and the document is displayed u201Cout placeu201C

  • How to display file content in browser using servlet..? urgent!!!

    hello,
    i am building a application for which when a user logs in he will we redirected to page where he will have one link ,with this link a file is associated.
    when user press that link he should be able to see that particular file in internet browser....
    now can anybody give me a code sample of how to display a file in browser....
    please reply me as soon as possible...

    thanks for your reply....
    but i don't want this....
    i want to read a file from disk into stream or buffer and from that again reading and printing in browser.....
    a servlet should be built for this....
    i wrote this but its not working
    ========================================================
    public class FilePrinting extends HttpServlet
         public void doPost(HttpServletRequest req,HttpServletResponse res)
              throws IOException,ServletException
              ServletOutputStream out=res.getOutputStream();
              res.setContentType("text/html");
              String fileURL="/mydomainWebApp/Test.htm";
              res.setHeader("Content-disposition","attachment; filename=" +="Test.htm" );
              BufferedInputStream bis=null;
              BufferedOutputStream bos=null;
              try
                   URL url = new URL( fileURL );
                   bis=new BufferedInputStream(url.openStream());
                   bos = new BufferedOutputStream(out);
                   byte[] buff = new byte[2048];
                   int bytesRead;
                   // Simple read/write loop.
                   while(-1 != (bytesRead = bis.read(buff, 0, buff.length))) {
                   bos.write(buff, 0, bytesRead);
              }catch(final MalformedURLException e)
                   System.out.println ( "MalformedURLException." );
                   throw e;
              }catch(final IOException e)
                   System.out.println ( "IOException." );
                   throw e;
              }finally
                   if (bis != null)
                        bis.close();
                   if (bos != null)
                        bos.close();
    =======================================================================
    please send me sample code if anyone have../...

  • Problem in display file content

    Hi all,
    I've a big problem about using the iFS content display function. My project needs to build up a document search engine and the search result, included the part of the document content, is required to display on the web interface.
    Most of the document I searched is PDF and MS word documents. I tried to use the feature in
    oracle.ifs.beans.document and get the content out and I tried so many function call there but the result seems not too successful. Following is the function call I tried before.
    1/.
    Document.filterDocument() ;
    Document.getFilteredDocument() ;
    As I know, it used the INSO filter to filter the document. The content return is fine for me, but not the format. No matter I put true/false into the Document.filterDocument(), the HTML format will also return instead of plaintext.
    I expected to return plaintext in this function so I can customise the format. But why it coudln't be?
    I guess there is something wrong about the INSO filter but I have no idea how to configure it....
    2/.
    Reader a;
    a=getContentReader();
    Nothing is return using ths function and it ususally reutrn the error message to me. I've no clue....
    3/.
    InputStream a=null;
    a=getContentStream();
    It return some strange byte code which is not what I need....
    4/.
    ContextThemes a=new ContextThemes[50];
    generateThemes(false);
    a=getThemes();
    Maybe it is not relevant function but I tried it.
    Nothing I returned to the object arrary.
    I will v.v.v. appreciate if someone can help (Hope the supports are not in holiday this moment...)
    null

    I checked the API of getContentStream() and getContentReader(). it will return the binary data of the document and the readable content will NEVER return to the Reader or InputStream variable.
    In addition, even the SimpleTextRenderer with ifsfileSystem.renderAsStream() function is used, the data returned also not the text data of the document. WHat I can get is the properties of that document object, not the useful content in the document.
    For the INSO filter Java function filteredContent(), no matter the true or false option chosen in the function, it can only return HTML result. It cannot return the text data!!!!!!
    I tried so many solution and it's also not work. I start feel ashame to use Oracle iFS!!! How can the function to be such a unreliable???
    HEY, Oracle Support, it is a high time for you to give us a clue.
    null

  • Finder not displaying file contents

    I have dropbox and configured it to show the icon on the tray over the left of my day/time.  When I click onto the folder via Finder, I see the folder icon.  The "Info" for this folder should allow me to read/write to the folder. However, when I ask to see the contents, I do not get a listing of the  files within the folder.  I am very frustrated since I have been struggling to resolve this configuration issue out on my own. It is most likely 'user issue' which led me here.  However, I am at my ropes end.  Can someone tell me how to fix this?
    Pete
    <Personal Information Edited By Host>

    Your original post wat to ask to see what was in that folder.  The command I gave was to show that.  There is one finder invisible zero-length file in that folder named .com.apple.timemachine.supported which I believe means it can be uses as a TB backup.
    If you want to always see these finder invisible files -- everywhere -- then follow the instructions in this article:
    Show Hidden Files in Mac OS X
    Now you are asking about the folder itself, i.e., what it's access is.  I would think you would see that doing Get Info in the finder.  But the terminal command to do it is similar to seeing the folder's contents:
    ls -lde /Users/petesalcido/Documents/Dropbox/London\ and\ Paris\ Pics\ 2012
    Just -lde instead of -la as the ls options (that's an "ell" in the -lde just like the ls).

  • PDF file contents of word document using XSLT.

    Hi Public,
    I am creating pdf file through the XML, XSL and FOP. I want PDF file contents to display external file contents such as word document.
    I know for displaying image in PDF we use <fo:external-graphic> but what tag we should to display file contents other than pdf file type.
    Thanks in advance.
    Rahul

    Your instructions for doing this are very clear. 

  • How to display the content from a file  stored in database

    when i am trying to display the content from a file which stored in database on oracle report 10g
    data are displaying as following. please help me to display the data in readable format
    <HTML LANG="en-US" DIR="LTR">
    <!-- Generated: 1/11/2006, postxslt.pl [1012] v1
    Source: amsug304286.xml
    File: amsug304286.htm
    Context: nil
    Tiers: ALWAYS
    Pretrans: YES
    Label: Release 12 -->
    <HEAD>
    <!-- $Header: amsug304286.htm 120.4 2006/11/01 20:57:29 appldev noship $ -->
    <!--BOLOC ug1_OMPO1010302_TTL--><TITLE>Product Overview (ORACLE MARKETING)</TITLE><!--EOLOC ug1_OMPO1010302_TTL-->
    <LINK REL="stylesheet" HREF="../fnd/iHelp.css">
    </HEAD>
    <BODY BGCOLOR="#F8F8F8">
    <A NAME="T304286"></A><A NAME="ProdOve"></A>
    <CENTER><H2><!--BOLOC ug1_OMPO1010302--><B>Product Overview</B><!--EOLOC ug1_OMPO1010302--></H2></CENTER>
    <p><!--BOLOC ug1_OMPO1010304-->Oracle Marketing drives profit, not just responses, by intelligently marketing to the total customer/prospect base. By leveraging a single repository of customer information, you can better target and personalize your campaigns, and refine them in real time with powerful analytical tools.<!--EOLOC ug1_OMPO1010304--></p>
    <p><!--BOLOC ug1_OMPO1006611-->With tools necessary to automate the planning, budgeting, execution, and tracking of your marketing initiatives, Oracle Marketing provides you with:<!--EOLOC ug1_OMPO1006611--></p>
    <ul>
    <li>
    <p><!--BOLOC ug1_OMPO1006612--><B>Customer Insight</B> - With sophisticated customer management and list generation, Oracle Marketing enables you to quickly generate target lists and segments using an intuitive user interface. The easy to use Natural Query Language Builder (NLQB) lets you query for customers or prospects using a natural language while hiding data complexity; fatigue management ensures that you do not over-contact the same customers with marketing messages; and predictive analytics helps you predict customer behavior that you can leverage to produce significant increases in marketing return on investments (ROI).<!--EOLOC ug1_OMPO1006612--></p>
    </li>
    <li>
    ls.<!--EOLOC ug1_OMPO1010304--></p>
    <p><!--BOLOC ug1_OMPO1006611-->With tools necessary to automate the planning, budgeting, execution, and tracking of your marketing initiatives, Oracle Marketing provides you with:<!--EOLOC ug1_OMPO1006611--></p>
    <ul>
    <li>
    <p><!--BOLOC ug1_OMPO1006612--><B>Customer Insight</B> - With sophisticated customer management and list generation, Oracle Marketing enables you to quickly generate target lists and segments using an intuitive user interface. The easy to use Natural Query Language Builder (NLQB) lets you query for customers or prospects using a natural language while hiding data complexity; fatigue management ensures that you do not over-contact the same customers with marketing messages; and predictive analytics helps you predict customer behavior that you can leverage to produce significant increases in marketing return on investments (ROI).<!--EOLOC ug1_OMPO1006612--></p>
    </li>
    <li>
    <p><!--BOLOC ug1_OMPO1006613--><B>Sales Alignment</B> - Oracle Marketing's leads management helps you compile and distribute viable leads so that sales professionals can follow up valuable opportunities and not just contact interactions. Additionally, support for distributing proposals and marketing material drive speedy and consistent setups and collaboration of best practices.<!--EOLOC ug1_OMPO1006613--></p>
    </li>
    <li>
    <p><!--BOLOC ug1_OMPO1006614--><B>Marketing Insight</B> - While Oracle Marketing Home page reports and Daily Business Intelligence (DBI) for Marketing and Sales provide aggregated management level information in almost real time, operational metrics help in tracking the effectiveness of individual marketing activities.<!--EOLOC ug1_OMPO1006614--></p>
    </li></ul>
    </BODY>
    </HTML>
    <!-- Q6z5Ntkiuhw&JhsLdhtX.cg&Zp4q0b3A9f.&RQwJ4twK3pA (signum appsdocopis 1162406236 2673 Wed Nov 1 10:37:16 2006) -->

    Hi,
    you can try to use the:
    <b>ConsumerTreeListPreview</b>
    layout for KM navigation ivew (or customize to your own).
    This layout shows a folder tree on the left, a document list on the right. When you click on a document from the list it shows the contents of the file on the bottom of the iview.
    Hope this helps,
    Romano

  • How to display the content of a file in the portal?

    Hey guys, could anyone help?
    I just created a page which includes two iView, one is KM Navigation iView to display a certain repository, while the other is for displaying the content of a certain file I click in the navigation iView.
    And now the problem is when I click a file in the KM Navigation iView, it will pop up a new window to display it. How can I make it displayed in a fixed iView, which type of this iView should be?

    Hi,
    you can try to use the:
    <b>ConsumerTreeListPreview</b>
    layout for KM navigation ivew (or customize to your own).
    This layout shows a folder tree on the left, a document list on the right. When you click on a document from the list it shows the contents of the file on the bottom of the iview.
    Hope this helps,
    Romano

  • Unable to display the Content of a data file from within another data file in Oracle webcenter portal.

    We have a Content Presenter taskflow. This task flow is added to a jspx page. The taskflow fetches the content from the contributor data file. The contributor data file is having a WYSIWYG editor. The content of the WYSIWYG editor is being displayed correctly through the task flow.
    We have some links in the WYSIWYG editor. These links again point to some data files. When we click on these links from within the portal, then we are getting a blank page(the url of this blank page is: http://localhost:7101/eWSIBPortal/faces/oracle/webcenter/sitestructure/render.jspx?datasource=UCM%23dDocName%3AWSIB_ARTICLE) and not displaying the content of the data file that we are pointing to from the WYSIWYG editor.
    We want to display the content of these data files(which we have pointed from WYSIWYG editor) in-line within the portal.
    Please help us to resolve this issue and let us know if any information is required from our end.

    Thanks for reply. However, can I use XSQL to dump the formated text to a file? or just can display to client through web browsers?

  • How to display a file content in view

    hi team,
    I have files which are already uploaded in SAP. I can read the contents of the file but
    I can't find the UI element where I can display the content of the file.
    I have heard that IFrame can be used to solve the purpose. But using IFrame I am only
    capable to show files which are in MIME objects.
    Can anybody give suggestions how to achieve it?

    Hi,
    have you tried
    <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/9d/a6884121a41c09e10000000a155106/frameset.htm">TextView</a> or <a href="http://help.sap.com/saphelp_nw2004s/helpdata/en/3b/219141c1d0ae5fe10000000a1550b0/frameset.htm">FormattedTextView</a> ?
    You could also make a development request.
    Regards, Heidi

  • Display blob content as pdf file

    Dear Expert,
    Currently i'm using oracle apex 3.0.1.
    I'm having a problem on displaying blob content (from database table) as pdf file on oracle application express but i'm able to save to download the pdf.
    Below is the procedure that i used to display blob content,
    PROCEDURE lf_html_pdf (pv_image IN VARCHAR2, pv_index IN NUMBER) is
    l_mime VARCHAR2 (255);
    l_length NUMBER;
    l_file_name VARCHAR2 (2000);
    lob_loc BLOB;
    BEGIN
    begin
    selecT OI_BLOB,DBMS_LOB.getlength (OI_BLOB)
    into lob_loc,l_length
    from ord_img
    where oi_tno= pv_image
    and oi_ti='PDF'
    and oi_idx=pv_index;
    exception
    when others then
    null;
    end;
    OWA_UTIL.mime_header (NVL (l_mime, 'application/pdf'), FALSE);
    HTP.p ('Content-length: ' || l_length);
    OWA_UTIL.http_header_close;
    WPG_DOCLOAD.download_file (lob_loc);
    END lf_html_pdf;
    I get the error message as below when i execute the procedure above;
    Error report:
    ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at "SYS.OWA_UTIL", line 356
    ORA-06512: at "SYS.OWA_UTIL", line 415
    ORA-06512: at "HCLABPRO.PKG_PDF", line 220
    ORA-06512: at line 2
    *06502. 00000 - "PL/SQL: numeric or value error%s"*
    I'm appreciated if expert can have me on the problem above?
    Thanks
    From junior

    *Always post code wrapped in <a href=http://wikis.sun.com/display/Forums/Forums+FAQ#ForumsFAQ-Arethereanyusefulformattingoptionsnotshownonthesidebar?"><tt>\...\</tt> tags</a>:*
      PROCEDURE lf_html_pdf (pv_image IN VARCHAR2, pv_index IN NUMBER) is
         l_mime        VARCHAR2 (255);
         l_length      NUMBER;
         l_file_name   VARCHAR2 (2000);
         lob_loc       BLOB;
      BEGIN
          begin
            selecT OI_BLOB,DBMS_LOB.getlength (OI_BLOB)
            into lob_loc,l_length
            from ord_img
            where  oi_tno= pv_image
              and oi_ti='PDF'
              and oi_idx=pv_index;
          exception
                when others then
                null;
            end;
         OWA_UTIL.mime_header (NVL (l_mime, 'application/pdf'), FALSE);
         HTP.p ('Content-length: ' || l_length);
         OWA_UTIL.http_header_close;
         WPG_DOCLOAD.download_file (lob_loc);
      END lf_html_pdf; Start by getting rid of:
          exception
                when others then
                null;and never using it anywhere ever again.
    If you're not actually going to use the <tt>l_mime</tt> and <tt>l_file_name</tt> variables then remove these as well. (Although I really think you should set a filename.)
    >
    Error report:
    ORA-06502: PL/SQL: numeric or value error
    ORA-06512: at "SYS.OWA_UTIL", line 356
    ORA-06512: at "SYS.OWA_UTIL", line 415
    ORA-06512: at "HCLABPRO.PKG_PDF", line 220
    ORA-06512: at line 2
    06502. 00000 - "PL/SQL: numeric or value error%s"
    >
    The error stack indicates that the exception is being raised in <tt>HCLABPRO.PKG_PDF</tt>: what is <tt>HCLABPRO.PKG_PDF</tt>? Does this actually have anything to do with the procedure above?
    I get the error message as below when i execute the procedure above;How do you execute it?
    What happens when it's executed without the <tt>when others...</tt> built-in bug?

  • Can we Read/Display the content of Word/PDF file  in Flex 3/4 ?

    Hello All,
    Can we  read/display the content of Word/PDF file in Flex 3 or Flex 4?.  I have one word file containing  Arabic  and English content with some settings like  Bold, Color, Align etc. I want to display the content of this word file as it is in the flex web application.
    Awaiting for prompt reply.
    Thanks and Regards

    thank you for your immediate reply, but,
    sorry, this does not work.
    With this code:
    <cfpdf action = "read" source = "dok_1.pdf" name =
    "mypdf">
    <cfdump var="#mypdf#"/>
    I get this result:
    Everything, but no text of the document.
    PDFDocument
    Application name of application
    Author bimbam Verlag GmbH
    CenterWindowOnScreen [empty string]
    ChangingDocument Allowed
    Commenting Allowed
    ContentExtraction Allowed
    CopyContent Allowed
    Created D:20080710
    DocumentAssembly Allowed
    Encryption No Security
    FilePath [empty string]
    FillingForm Allowed
    FitToWindow [empty string]
    HideMenubar [empty string]
    HideToolbar [empty string]
    HideWindowUI [empty string]
    Keywords [empty string]
    Language [empty string]
    Modified [empty string]
    PageLayout SinglePage
    Printing Allowed
    Producer [empty string]
    Properties [empty string]
    Secure Allowed
    ShowDocumentsOption [empty string]
    ShowWindowsOption [empty string]
    Signing Allowed
    Subject [empty string]
    Title Rheinische Angler-Zeitschrift
    TotalPages 1
    Trapped [empty string]
    Version 1.3
    Maybe i do not understand the cfpdf tag the right way.
    What i want is a kind of pdf-to-text conversion.
    Do I have to use the processddx action? I do not think so.
    But there is a property DocumentText .. ?

  • Need to read text file content and have to display it in multiline text box

    dear all,
    Need to read text file content and have to display it in multiline text box.
    actually im new to file handling. i have tried up to get_line and put_line.
    in_file := TEXT_IO.FOPEN ('D:\SAMPLE.txt', 'r');
    TEXT_IO.GET_LINE (in_file,linebuf);
    i dont know how to assign this get_line function to text item
    pls help me in this regards,

    Simply write:
    in_file := TEXT_IO.FOPEN ('D:\SAMPLE.txt', 'r');
    TEXT_IO.GET_LINE (in_file,linebuf);
    :block2.t1 := chr(10)||:block2.t1||chr(10)||linebuf;
    chr(10) --> is for new line character

  • Displaying doc/txt file contents from portlet

    Hi, Can someone pls give a hint on how to do this:
    One "book" type content created, with a doc file uploaded. The "publisher " for
    this content is set to "sams".
    create a content selector which retrieves only this (content) book correctly.
    create two portlets. one portlet with above content selector inserted, displays
    the publisher name with a hyperlink.
    I want the other portlet to display the contents of the file uploaded, for this
    publisher. I could establish portlet comm. and could display other properties
    of the book such as "author/titile" on the second portlet, but want to know how
    to display the uploaded file contents.
    thanks much,
    -developer

    As far as retriving the contents of an uploaded file...
    If your XML document has been loaded into Content Management as a binary
    property, you have two options:
    a) to directly inline the content into the JSP, do something like this:
    <cm:getProperty id="node" name="binaryPropertyName" failOnError="true"
    isMultiple="false"/>
    (This assumes node holds a reference to the Content Management Node
    object (perhaps retrieved via a <cm:getNode> tag)
    b) to retrieve the value into a script variable for more processing, do
    something like this:
    <%
    Property bodyProp= (Property)node.getProperty("binaryPropertyName");
    InputStream in= node.getPropertyBytes( bodyProp.getId() );
    // dont forget to close the InputStream
    String result=null;
    InputStreamReader reader= new InputStreamReader(in);
    StringBuffer streamContents= new StringBuffer();
    char[] data= new char[8192];
    int charsRead;
    while ((charsRead = reader.read(data)) > 0 )
    streamContents.append(data, 0, charsRead);
    result= streamContents.toString();
    %>
    -Steve
    "portal developer" <[email protected]> wrote in message
    news:40ae343d$[email protected]..
    >
    Hi, Can someone pls give a hint on how to do this:
    One "book" type content created, with a doc file uploaded. The "publisher" for
    this content is set to "sams".
    create a content selector which retrieves only this (content) bookcorrectly.
    >
    create two portlets. one portlet with above content selector inserted,displays
    the publisher name with a hyperlink.
    I want the other portlet to display the contents of the file uploaded,for this
    publisher. I could establish portlet comm. and could display otherproperties
    of the book such as "author/titile" on the second portlet, but want toknow how
    to display the uploaded file contents.
    thanks much,
    -developer

Maybe you are looking for

  • Final cut studio 2

    I am installing final cut studio 2 on my computer and its been awhile since I bought it so I am not sure which disc its asking for. I have so many final cut disc here mixed up here, I put in the install disc and then it ask for Audio Content one coul

  • How to preset the order of rows in the outer query of a correlated query ?

    Good morning, I have the following simple query: select empno,        ename,        sal,        sum(case              when rn = 1 then sal              else -sal            end) over (order by sal, empno) as running_diff    from (          select emp

  • Can I restore from Time Machine backup after replacing hard drive

    I'm planning on replacing the 250GB hard drive in my mid 2010 13 inch MBP with a larger one. My MBP comes with Snow Leopard, and I've installed Lion and recently Mountain Lion from App Store. Can I use my Snow Leopard disc to boot up the laptop after

  • Output Through FAX and Email for Order Confirmation

    We are yet to have this in our system and in requirements gather phase for my FS. I request you to help me in finishing this . so far i considered the following The following information is required : 1. To all SD documents ? ( For eg : Order Confirm

  • New AFCS Build Posted!

    As usual, let us know if you have any comments, questions or bugs. We'll be answering more of the backlog of questions now that we can come up for air =). Log into https://afcs.acrobat.com to get the latest. Version 0.93 We're still primarily focused