File Upload Scenario

Hi All,
Can anyone give me some resources for creating a File Upload application ??
TXT file to Internal Table.
(new to BSP)
Thanks in Advance
Chemmanz

They are useful but i need to SAVE that i uploaded file to SAP.
But i think that applications hold files in cache.
I want i can download file when i want.
Thanks
ibrahim
Message was edited by: Ibrahim UGUR

Similar Messages

  • Unable to submit form without attachment if file upload fails

    Hi All,
    I have a form, in which I have a input file component.
    Scenario 1 - If i don't attach anything and submit the form, it is successful.
    Scenario 2 - If I attach a file of size less than 2 MB and then submit, it is successful.
    Scenario 3 - If I attach a file of size greater than 2 MB and then submit, ADF gives an error message saying " File is large" which is expected.
    3.1 - In the scenario 3, after file upload fails, I want to submit the form without attaching any file. But the form isn't submitted and the warning message always pops up.
    3.2 - If I upload file of size less than 2MB again and then submit, it is successful.
    Please help me in resolving the issue.
    Thanks,
    Harini.

    Try clearing the error messages
    <af:resource type="javascript">
    function clearMessagesForComponent(evt){
    AdfPage.PAGE.clearAllMessages();
    evt.cancel();
    </af:resource>Now all yo uneed to do is to call this javascript method e.g. using a <af:clientListener method="clearMessagesForComponent" type="focus"/>on a button or any other field.
    Timo

  • File Upload using PRC API's

    Guys,
    I am trying to upload a new document using PRC API's. Below is required code snippet that i am using.
    IRemoteDocument remoteDoc = documentManager.createRemoteDocument(folderID,dataSourceID,document.getPath()); remoteDoc.setOverrideName(document.getName()); remoteDoc.setOverrideDescription(document.getDescription()); remoteDoc.setType("http://www.plumtree.com/dtm/mime", document.getFileType());int docID = -1;docID = remoteDoc.save();
    dataSourceID - ID of my file upload datasource , document - is my java object which has all the document related properties such as , name , description , MIME type of document etc..Below is different document path's(scenarios) that I have triedc:\work\sample.txt\\servername\work\sample.txthttp:\\appserver:7001\appName\uploadfiles\sample.txt
    When I execute this code from my application i get a below error.
    com.plumtree.remote.prc.PortalException: null; nested exception is: java.rmi.RemoteException: Error in function PTDataSource.ImportDocument(vDocumentLocationBagAsXML == '<?xml version="1.0" encoding="ucs-2"?><PTBAG V="1.1" xml:space="preserve"><I N="PTC_DTM_SECT">1001</I><S N="PTC_DOC_ID">application/msword</S><S N="PTC_UNIQUE">\\PHUSEH-L33664.NA.novartis.net\work\sample.doc</S></PTBAG>', lDocumentTypeID == 100, pCard == com.plumtree.server.impl.directory.PTCard@c27b6f, bSummarize == false, pProvider == null): Error in function PTDataSource.ImportDocument (vDocumentLocationBagAsXML == <?xml version="1.0" encoding="ucs-2"?><PTBAG V="1.1" xml:space="preserve"><S N="PTC_DOC_ID">application/msword</S><I N="PTC_DTM_SECT">1001</I><S N="PTC_UNIQUE">\\PHUSEH-L33664.NA.novartis.net\work\sample.doc</S></PTBAG>, lDocumentTypeID == 100, pCard == com.plumtree.server.impl.directory.PTCard@c27b6f, bSummarize == false, pProvider == null): SOAP fault: faultcode='soapenv:Server.userException' faultstring='java.lang.NullPointerException' at com.plumtree.remote.prc.DocumentWrapper.save()
    Below is my environment.Plumtree is running on Weblogic 8.1 (Solaris OS) , ptupload webservice is running on weblogic8.1 solaris,My upload document portlet is running on weblogic 8.1 (Windows OS)
    If anyone has any working sample code please send it to my ID [email protected] or else please upload it here.Thank You ,
    Dan.

    make sure your modjk logs don't have any errors.
    Here's a peice out of my httpd.conf
    #ADDed Oct 15,2003, seemed to remove modjk error
    AddType multipart/form-data .gif .png  .jpg .peg .jpeg .jpeI used to get strange modjk logged errors.
    Also did you compile jk2 from source???
    com.oreilly.servlet --- cos
    http://www.servlets.com/cos/index.html
    http://www.servlets.com/cos/cos-05Nov2002.zip
    But if my bit shift is correct wouldn't my regular textfile upload be distored?From what I remember, the problem is something to do with logical AND or OR, with the bits. Apache receives it fine, passess it through jk, and and either the most sig or least gets lost. Image data is critical as every bit counts, text file, you may not notice it(white space), or every nTH file upload might fail.
    here are the version numbers of software I use, and have compiled all from source.
    apache-httpd-2.0.47
    tomcat-4.1.27
    jk2-connectors-2.0.2

  • How to upload multiple files in Webdynpro using File upload Screen Element

    Hi Experts,
          Can anybody tell me how to upload multiple files/pdfs in webdynpro using file upload screen element, and also please tell me what is the maximum storage limit of RAWSTRING data type,Advance Thanks.
    Regards,
    Sandesh

    Hi Sandesh,
    this is simply not supported, not in WebDynpro nor in standard HTML.
    A workaround is to upload a ZIP with all files and on server side unpack the ZIP and operate on the single files.
    I hope it will  help u..
    ----------------------OR-------------------------
    As you know using File upload UI element we can upload only one file at a time. There may be a scenario where user may want to upload any no of files at a time which is not determined at design time. This can be acheived using the ACF UpDownload UI element which requires a security whiltelist to be created
    http://scn.sap.com/docs/DOC-2270
    ----------------------OR-------------------------
    You can use Table UI element.
    Regards,
    Deepak Singh

  • IMP:ClassCastException while using File upload UI in Webdynpro for java

    Hi All,
    I have used a FileUpload UI element in my screen , which is working fine for only the first time we upload a file. If we try to upload any file with out refreshing the application , a ClassCastException is being thrown. Please help me in resolving the issue.
    Thanks in advance.
    Srikanth

    Thank you!!
    1. But when i use the File Upload UI and try to use the 'data' property to retrieve the bytes i am getting a null pointer exception meaning the data is not being picked up by the UI even though browsed file has data.
    2. How I am I supposed to set the 'Resource' property while downloading a PDF which has UTF-16 text and picture??
    Note: I have done the same scenario using WD04 java without any trouble.
    reg
    vln

  • Error handling for file upload

    HI Experts,
    I have a question on file upload process in sap MDG-S.
    Scenario : Upload the content from a CSV file using the file upload prcoess.
    Query : For example if there are 5 records in the file and if there is an error in 3rd record what happens to the rest of the records i.e. 1,2 and 3,4.
    a) Will record 1 and record 2 get posted and record 3,4 will be failed?
    b) All 4 records will not be posted as there is one errored record.
    Regards,
    Charita.

    Hi charitha,
    As per your request if there is a error in any of the record in a particular file it does'nt loads any of the fields to the target, it will be terminated  with an error.
    As i checked with an example of Space delimited file in which 4th field has no spaces, and i used this file as source and run the job it does'nt return any values but terminated with an error.
    let me know if i am right..
    Regards,
    Amjad

  • Bps file upload error in Bsp

    hi marc,
    i need a small help from you.i am uploading file into bps web,i followed your pdf guide.it is working fine.in my scenario,i had developed a screen design and in that i wants to incorporate the file upload functinality.when we generate the bps application corrsponding bsp will be generated and in bsp, the page design will be in the views not in the layout,here iam getting the problem,when i write the code in the oninputprocessing the below code is not responding,when i try to do change in the layout my original design is getting disturbed.my code is as follows in the oninputprocessing plz advice me.
    iam getting dump at the bolded line below as null value is passed.plz help me out.
    CLASS CL_HTMLB_MANAGER DEFINITION LOAD.
    CONSTANTS:
    c_memory_id_file_upload TYPE memory_id VALUE 'Z_SEM_BPS_FILE_UPLOAD'.
    DATA:
    lv_objname TYPE lxeobjname,
    lr_page TYPE REF TO if_http_entity,
    l_content_path TYPE string,
    l_content TYPE string,
    l_subrc TYPE sy-subrc,
    ls_bapiret TYPE bapiret2,
    lt_bapiret TYPE STANDARD TABLE OF bapiret2,
    ls_mesg TYPE upc_ys_mesg,
    lt_mesg TYPE upc_yt_mesg,
    request1 type ref to IF_HTTP_REQUEST.
    DATA: event TYPE REF TO CL_HTMLB_EVENT.
    REFRESH lt_mesg.
    IF event_id = CL_HTMLB_MANAGER=>EVENT_ID.
    event = CL_HTMLB_MANAGER=>get_event( runtime->server->request ).
    IF event->name = 'button' AND event->event_type = 'click'.
    DATA: button_event TYPE REF TO CL_HTMLB_EVENT_BUTTON.
    button_event ?= event.
    ENDIF.
    endif.
    case event->id.
    when 'upload'.
    lv_objname = request->get_form_field( 'file' ).
    lr_page = request1->get_multipart( 1 ).
    <b>l_content_path = lr_page->get_header_field( '~content_filename' ).</b>
    l_content = lr_page->get_cdata( ).
    IF l_content IS NOT INITIAL.
    Export file contents to memory
    EXPORT content FROM l_content TO MEMORY ID c_memory_id_file_upload.
    endif.
    endcase.
    create statistic node for performance measurements
    type-pools: upcst.
    cl_upwb=>statistic_open( i_node_name = upcst_c_web_input_proc
    i_page = page
    i_request = request ).
    call input processing here
    call method application->inputProcessing(
    event_id = event_id
    runtime = runtime
    page = page
    request = request
    navigation = navigation
    version = 300
    close the statistic node
    cl_upwb=>statistic_close( i_node_name = upcst_c_web_input_proc ).

    Hello Bharan,
    the file upload must run in its own BSP application. Otherwise the header for the file content is not filled properly. You can use an iframe to embed the upload application into a BPS web interface for example.
    Regards,
    Marc
    SAP NetWeaver RIG

  • 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

  • File Upload weblogic 8.1 Struts 1.1

    I am getting this error while file uploading in struts Could not
    deserialize session data CommonsMultipartRequestHandler
    I read this bug is solved in struts 1.1 i am working on weblogic 81. with
    struts 1.1
    Can anybody help
    Thanks
    Shail
    <Jul 17, 2004 1:36:16 PM GMT+05:30> <Warning> <HTTP> <BEA-101138>
    <ServletContext(id=28000914,name=DefaultWebApp,context-path=) One of the
    getParameter family of methods called after reading from the
    ServletInputStream. Not merging post parameters.>
    Jul 17, 2004 1:38:35 PM org.apache.struts.util.PropertyMessageResources
    <init>
    INFO: Initializing, config='org.apache.struts.util.LocalStrings',
    returnNull=true
    Jul 17, 2004 1:38:35 PM org.apache.struts.util.PropertyMessageResources
    <init>
    INFO: Initializing, config='org.apache.struts.action.ActionResources',
    returnNull=true
    Jul 17, 2004 1:38:36 PM org.apache.struts.util.PropertyMessageResources
    <init>
    INFO: Initializing, config='ApplicationResources', returnNull=true
    <Jul 17, 2004 1:38:36 PM GMT+05:30> <Error> <HTTP> <BEA-101309>
    <[ServletContext(id=28000914,name=DefaultWebApp,context-path=)] could not
    deserialize the context attribute
    "org.apache.struts.action.REQUEST_PROCESSOR"
    java.io.NotSerializableException: org.apache.struts.action.RequestProcessor
    at
    java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
    at
    java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
    at
    weblogic.servlet.internal.AttributeWrapper.getObject(AttributeWrapper.java:9
    1)
    at
    weblogic.servlet.internal.AttributeWrapper.getObject(AttributeWrapper.java:6
    6)
    at
    weblogic.servlet.internal.WebAppServletContext.getAttribute(WebAppServletCon
    text.java:633)
    at
    org.apache.struts.action.ActionServlet.getRequestProcessor(ActionServlet.jav
    a:855)
    at
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    at
    org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at
    weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(Servle
    tStubImpl.java:1053)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :387)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :305)
    at
    weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(W
    ebAppServletContext.java:6291)
    at
    weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubjec
    t.java:317)
    at
    weblogic.security.service.SecurityManager.runAs(SecurityManager.java:97)
    at
    weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
    ntext.java:3575)
    at
    weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
    :2573)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:178)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:151)
    >
    <Jul 17, 2004 1:38:36 PM GMT+05:30> <Error> <HTTP Session> <BEA-100028>
    <Could not deserialize session data.
    java.io.NotSerializableException:
    org.apache.struts.upload.CommonsMultipartRequestHandler$CommonsFormFile
    at
    java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1054)
    at
    java.io.ObjectOutputStream.defaultWriteFields(ObjectOutputStream.java:1330)
    at
    java.io.ObjectOutputStream.writeSerialData(ObjectOutputStream.java:1302)
    at
    java.io.ObjectOutputStream.writeOrdinaryObject(ObjectOutputStream.java:1245)
    at
    java.io.ObjectOutputStream.writeObject0(ObjectOutputStream.java:1052)
    at
    java.io.ObjectOutputStream.writeObject(ObjectOutputStream.java:278)
    at
    weblogic.servlet.internal.AttributeWrapper.getObject(AttributeWrapper.java:9
    1)
    at
    weblogic.servlet.internal.AttributeWrapper.getObject(AttributeWrapper.java:6
    6)
    at
    weblogic.servlet.internal.session.SessionData.getAttribute(SessionData.java:
    419)
    at
    org.apache.struts.util.RequestUtils.createActionForm(RequestUtils.java:777)
    at
    org.apache.struts.action.RequestProcessor.processActionForm(RequestProcessor
    .java:364)
    at
    org.apache.struts.action.RequestProcessor.process(RequestProcessor.java:253)
    at
    org.apache.struts.action.ActionServlet.process(ActionServlet.java:1482)
    at
    org.apache.struts.action.ActionServlet.doPost(ActionServlet.java:525)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:760)
    at javax.servlet.http.HttpServlet.service(HttpServlet.java:853)
    at
    weblogic.servlet.internal.ServletStubImpl$ServletInvocationAction.run(Servle
    tStubImpl.java:1053)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :387)
    at
    weblogic.servlet.internal.ServletStubImpl.invokeServlet(ServletStubImpl.java
    :305)
    at
    weblogic.servlet.internal.WebAppServletContext$ServletInvocationAction.run(W
    ebAppServletContext.java:6291)
    at
    weblogic.security.acl.internal.AuthenticatedSubject.doAs(AuthenticatedSubjec
    t.java:317)
    at
    weblogic.security.service.SecurityManager.runAs(SecurityManager.java:97)
    at
    weblogic.servlet.internal.WebAppServletContext.invokeServlet(WebAppServletCo
    ntext.java:3575)
    at
    weblogic.servlet.internal.ServletRequestImpl.execute(ServletRequestImpl.java
    :2573)
    at weblogic.kernel.ExecuteThread.execute(ExecuteThread.java:178)
    at weblogic.kernel.ExecuteThread.run(ExecuteThread.java:151)
    >
    <Jul 17, 2004 1:38:37 PM GMT+05:30> <Warning> <HTTP> <BEA-101138>
    <ServletContext(id=28000914,name=DefaultWebApp,context-path=) One of the
    getParameter family of methods called after reading from the
    ServletInputStream. Not merging post parameters.>

    In my application i have some java user defined objects that contains a list and on that list I have some other objects and those objects contains again a java object and those objects containing again some simple java beans that contains data fetched from database.
    It is basically a scenario for report generation
    And I am getting the following error
    ####<Dec 5, 2006 8:41:04 PM CST> <Error> <Cluster> <MDS0JEAPPIP01> <mps_prod_iprice_1> <ExecuteThread: '7' for queue: 'weblogic.kernel.Default'> <<WLS Kernel>> <> <BEA-000126> <All session objects should be serializable to replicate. Check the objects in your session. Failed to replicate non-serializable object.>
    But if the data is empty then I am not getting this error at that time also the object was in session scope but with null value as there is no data.

  • Interruption file upload breaks servlet engine...

    Hi,
    I've written a file upload servlet, which works great, until someone abandons an upload half way through the process. My servlet seems to block open a port or process, and cause my jsp pages to stop responding!!! resulting in breaking my site. I have to manually kill the servlet engine, and restart the process. The JSP engine is tomcat 4.1.27. Any ideas on preventing the system locking up, or where i can look for clues as to what is actually happening would be greatly appreciated.
    TIA
    Steve

    You'll have to debug it - for example, sprinkle System.out.println("now I'm here in the code") statements, and reproduce the scenario by invoking it yourself and aborting the upload. It should throw an exception while you're reading the upload stream - maybe you're not handling that correctly.

  • 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

Maybe you are looking for

  • HP printer driver not working with 10.8.2

    Can anyone give me advice on how to make my all in one laserjet HP printer M2727nf work in 10.8.2.  Downloaded new driver software on January 10, since the new OS software update today again the printer is no longer connecting.  I have given up on th

  • Keyboard and Trackpad Unresponsive

    I recently had to replace a failing harddrive in my early 2008 MBP and afterwards everything worked fine. I then installed VMWare with Ubuntu everything worked fine, then I tried to install Windows 7 and afterwards my trackpad and keyboard are unresp

  • Email send issue using "Mail Server Load balancer"  (Cisco ACE 20)

    Please let me know if someone have experienced this kind of issue or any suggestions. The send email action was working file in MII with smtp mail server on port 25. Recently basis did a change in mail server ip address and they installed a new Load

  • How can I uninstall leopard ?!!

    I hope someone can help me. I bought Lepoard last week and I want it out of my MacBook Pro. Its slowing my computer down. How can I go back to Tiger? Will all the leopard components be definitely gone? Thanks! regards to all.. / Alexis

  • Anchor point tool doesn't work properly

    When I use the anchor point tool and want to adjust a path line, Adobe Flash often doesn't react until the 2nd or 3nt try. Does anyone know a solution for this? I use Adobe Flash CS6. Thanks for help