File upload & download through web Dynpro

Hai All,
     Now i am working in webDynpro 2.0.9. For file upload
and download through webdynpro "resource" is used.But in my webdynpro version 2.0.9. "resource" is not possible.so tell me how to upload & download by using this version & what is the alternative way for this.
Thanks in advance.
Kindly Regards,
s.v.selva bala

HI,
Try out this code :
FileInputStream is = new FileInputStream(file);
      long length = file.length();
      byte[] bytes = new byte[(int)length];
      long bytesRead = is.read(bytes);
      if (bytesRead < length)
       throw new IOException("Could not completely read file "+file.getName());
      is.close();
element.setDocumentContent(bytes);
Create a context attribute of binary type and assign the read data to it and bind the dataSource property of your File Upload and Download properties to this context Attribute.
Regards
Sid

Similar Messages

  • HI Masters , I need information for file upload program in web dynpro java

    Hi masters,
           i need some inforamtion and documentation on file upload program in web dynpro java

    Hi surya,
    You can follow this procedure to upload the file
    i) Take One Context Attribute named as "D1" of Type "binary".
    ii) Take one FileUpload UI Element in the Layout Tab.
    iii) Bind FileUpload UI Element's data Property to the taken Context Attribute. Here it is "D1".
    iv) Take one Button UI Element in the Layout Tab named "Upload" and in the Action of that Button write the following Code.
    v) The following code Generates one Folder in the Server & inside that Folder given file is Uploaded.
    File ff=new File("FolderXYZ"); // Creates One Folder with the given Name ( Here Folder name is "FolderXYZ")
    ff.mkdir();
    try
    byte b[]=null;
    IWDAttributeInfo objAttinfo=null;
    IWDModifiableBinaryType binType=null;
    File f=null;
    FileOutputStream fos=null;
    if(wdContext.currentContextElement().getD1()!=null)
    b=wdContext.currentContextElement().getD1();
    objAttinfo=wdContext.getNodeInfo().getAttribute(IPrivateAttachView.IContextElement.D1);
    binType=(IWDModifiableBinaryType)objAttinfo.getModifiableSimpleType();
    f=new File(ff.getName()+"
    "+binType.getFileName());
    fos=new FileOutputStream(f);
    fos.write(b);
    fos.flush();
    fos.close();
    objMessageManager.reportSuccess("File uploaded to server");
    } catch (Exception e)
    objMessageManager.reportException("Unable to upload file to server, error is:"+e,false);
    return;
    The Uploaded file is stored in the folder & that folder is stored in the Server's following Path.
    <Your Server>\c$\usr\sap\J2E\JC00\j2ee\cluster\server0
    You can access your Uploaded file from the following Path
    <Your Server>\c$\usr\sap\J2E\JC00\j2ee\cluster\server0\FolderXYZ
    Regards
    Sagar Ingalwar

  • Send pdf file to workflow through web dynpro.

    Hi All,
    I have a web dynpro component, with this component i am raising a request, which will go to multiple level of approvals(for this triggering workflow from web dynpro).
    Now i want to send a pdf file as an attachment to approvers work items.
    For this i have used File Upload UI element, and i have binded data property of this upload UI element with an attribute of type Xstring.
    Now can you please help me to send this file to workflow.
    I am able to send a pdf file as an attachment through executable report (SE38), but same functionality is not working from web dynpro.
    Code used in executable report is as below:
    DATA: t_data_tab TYPE TABLE OF x255,
    bin_size TYPE i,
    buffer_x TYPE xstring,
    buffer_zip TYPE xstring,
    filename TYPE string VALUE 'C:\Documents and Settings\My Documents\Downloads\IT.pdf'.
    CALL FUNCTION 'GUI_UPLOAD'
    EXPORTING
    filename                      = filename
    filetype                      = 'BIN'
    IMPORTING
    filelength                    = bin_size
      HEADER                        =
    TABLES
    data_tab                      = t_data_tab.
    **get xstring
    CALL FUNCTION 'SCMS_BINARY_TO_XSTRING'
      EXPORTING
        input_length = bin_size
      IMPORTING
        buffer       = buffer_x
      TABLES
        binary_tab   = t_data_tab.
    IF sy-subrc <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    ZSWR_ATT_HEADER-FILE_TYPE = 'B'.
    ZSWR_ATT_HEADER-FILE_NAME = 'FORM-407'.
    ZSWR_ATT_HEADER-FILE_EXTENSION = 'PDF'.
    ZSWR_ATT_HEADER-LANGUAGE = 'EN'.
    WORKITEMID = '000000401208'.
    CALL FUNCTION 'SAP_WAPI_ATTACHMENT_ADD'
      EXPORTING
        WORKITEM_ID          = WORKITEMID
        ATT_HEADER           = ZSWR_ATT_HEADER
      ATT_TXT              =
        ATT_BIN              = buffer_x
       DOCUMENT_OWNER       = SY-UNAME
       LANGUAGE             = SY-LANGU
       DO_COMMIT            = 'X'
    IMPORTING
      RETURN_CODE          =
       ATT_ID               = ZSWR_ATT_ID
    TABLES
      MESSAGE_LINES        = SWR_MESSAG
    *MESSAGE_STRUCT       =
    if sy-subrc = 0.
    else.
    endif.
    But function "GUI_UPLOAD" is not working in web dynpro.
    Regards,
    Amar

    HI,
    Try out this code :
    FileInputStream is = new FileInputStream(file);
          long length = file.length();
          byte[] bytes = new byte[(int)length];
          long bytesRead = is.read(bytes);
          if (bytesRead < length)
           throw new IOException("Could not completely read file "+file.getName());
          is.close();
    element.setDocumentContent(bytes);
    Create a context attribute of binary type and assign the read data to it and bind the dataSource property of your File Upload and Download properties to this context Attribute.
    Regards
    Sid

  • To get content of file upload element in web dynpro

    Hi . . .
    h1 : how can i get the string content   (i.e., path of file) store in variable in web dynpro abap . . . .

    Hi . . .
    h1 : how can i get the string content   (i.e., path of file) store in variable in web dynpro abap . . . .

  • File upload and download through web Dynpro2.0.9.

    Hai All,
          File upload and download through web Dynpro "IWDResource" package is used.But in web Dynpro 2.0.9. this package is not possible.How to uplolad and download  files through web Dynpro2.0.9.
          Anyone can help me?
    Thanks in Advance,
    Kindly Regards,
    K.Saravanan.

    Hi Saravanan,
    You can go through these links,
    <a href="http://help.sap.com/saphelp_nw04/helpdata/en/63/9c0e41a346ef6fe10000000a1550b0/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/63/9c0e41a346ef6fe10000000a1550b0/frameset.htm</a>
    <a href="http://help.sap.com/saphelp_nw04/helpdata/en/5a/90ff4cd0c8cd48a69b836e5e550880/frameset.htm">http://help.sap.com/saphelp_nw04/helpdata/en/5a/90ff4cd0c8cd48a69b836e5e550880/frameset.htm</a>
    So, apart from putting FileUpload UI on your view, you have to implement a method which will do the actual uplod for you.
    Hope this helps.
    Regards,
    Mausam

  • Upload and Attach file to Service Notificacion through Web Dynpro

    Hi,
    I need to upload and attach a file (Word, PDF, TXT ...) to Service Notificacion (TX - IW53) through Web Dynpro.
    I have used the integration component "File Upload" to obtain the "fileName" atribute. Also, I have used the functions SO_OBJECT_UPLOAD, SO_INSERT_OBJECT and BINARY_RELATION_CREATE_COMMIT.
    But have a problem, because the function SO_OBJECT_UPLOAD use the class "cl _ gui _ frontend _ services" and that clash with Web Dynpro.
    My question is: how could I resolve that problem?
    I look forward to your response.
    Thanks

    IV_NAME     Importing     Type     STRING
    IV_CONTENT     Importing     Type     STRING
    IV_CONTENT_HEX     Importing     Type     XSTRING
    IS_LPORB     Importing     Type     SIBFLPORB
    IV_OBJTP     Importing     Type     SO_OBJ_TP
    RT_MESSAGES     Returning     Type     BAPIRETTAB
    method save.
      data ls_message type bapiret2.
      data:
        filename     type string,
        filefullname type string,
        mime_type    type string,
        size         type i,
        offset type i,
        offset_old type i,
        temp_len type i,
        objname type string,
        l_obj_type type so_obj_tp,
        hex_null type x length 1 value '20',
        l_document_title type so_text255,
        file_ext type string,
        lt_objcont type standard table of  solisti1 initial size 6,
        objcont like line of lt_objcont,
        lt_ls_doc_change type standard table of sodocchgi1,
        ls_doc_change like line of lt_ls_doc_change,
        lt_data type soli_tab,
        ls_data type soli,
        lt_xdata type solix_tab,
        ls_xdata type solix,
        l_folder_id type sofdk,
        ls_object_id type soodk,
        l_object_id_fol type so_obj_id,
        l_object_id type so_obj_id,
       l_doc_info TYPE sofolenti1,
        l_object_hd_change type sood1,
        l_tab_size type int4,
        l_retype type breltyp-reltype,
        lt_urltab  type standard table of sood-objdes.
    get foler
    l_folder_id = 'FOL29000000000004'.
      call function 'SO_FOLDER_ROOT_ID_GET'
        exporting
         owner                            = sy-uname
          region                           = 'B'
        importing
          folder_id                        = l_folder_id
       tables
         path_table                       =
      if iv_objtp = gc_type_file.
        size = xstrlen( iv_content_hex ).
    get file name and extension
        call method split_path
          exporting
            iv_path           = iv_name
          importing
         E_PATH           =
           ev_filename       = filename
         E_PSERVER        =
        call method split_file_extension
          exporting
            iv_filename_with_ext = filename
          importing
            ev_filename          = objname
            ev_extension         = file_ext.
        ls_doc_change-obj_name = objname.
        ls_doc_change-obj_descr = objname.
        ls_doc_change-obj_langu = sy-langu.
        ls_doc_change-sensitivty = 'F'.
        ls_doc_change-doc_size = size.
        offset = 0.
        while offset <= size.
          offset_old = offset.
          offset = offset + 255.
          if offset > size.
            temp_len = xstrlen( iv_content_hex+offset_old ).
            clear ls_xdata-line with hex_null in byte mode.
            ls_xdata-line = iv_content_hex+offset_old(temp_len).
          else.
            ls_xdata-line = iv_content_hex+offset_old(255).
          endif.
          append ls_xdata to lt_xdata.
        endwhile.
    set object type relation type and other header info
        l_retype = 'ATTA'.
        l_obj_type = 'EXT'.
        l_object_hd_change-objnam = ls_doc_change-obj_name.
        l_object_hd_change-objdes = ls_doc_change-obj_descr.
        l_object_hd_change-objsns = ls_doc_change-sensitivty.
        l_object_hd_change-objla  = ls_doc_change-obj_langu.
        l_object_hd_change-objlen = ls_doc_change-doc_size.
        l_object_hd_change-file_ext = file_ext.
      prepare header
        data lt_obj_header type standard table of solisti1.
        data ls_header type solisti1.
        concatenate '&SO_FILENAME=' filename into ls_header.
        append ls_header to lt_obj_header.
        clear ls_header.
        ls_header = '&SO_FORMAT=BIN'.
        append ls_header to lt_obj_header.
    change hex data to text data
        call function 'SO_SOLIXTAB_TO_SOLITAB'
          exporting
            ip_solixtab = lt_xdata
          importing
            ep_solitab  = lt_data.
      else.
    for note
        size = strlen( iv_content ).
        objname = iv_name.
        ls_doc_change-obj_descr = objname.
        ls_doc_change-sensitivty = 'O'.
        ls_doc_change-obj_langu  = sy-langu.
    put content into table
        offset = 0.
        if iv_objtp = gc_type_note.
    it's a note
          l_retype = 'NOTE'.
          l_obj_type = 'RAW'.
          l_object_hd_change-file_ext = 'TXT'.
    read note content into table
          while offset <= size.
            offset_old = offset.
            offset = offset + 255.
            if offset > size.
              temp_len = strlen( iv_content+offset_old ).
              clear ls_data-line.
              ls_data-line = iv_content+offset_old(temp_len).
            else.
              ls_data-line = iv_content+offset_old(255).
            endif.
            append ls_data to lt_data.
          endwhile.
    get title from content , if it's initial
          if objname is initial.
            read table lt_data index 1 into l_document_title.
            while l_document_title+49 <> ' '.
              shift l_document_title right.
            endwhile.
            shift l_document_title left deleting leading ' '.
            ls_doc_change-obj_descr = l_document_title.
          endif.
        else.
    it's url (not note)
          l_retype = 'URL'.
          l_obj_type = 'URL'.
          if objname is initial.
            split iv_content at '/' into table lt_urltab.
            describe table lt_urltab lines l_tab_size.
            read table lt_urltab index l_tab_size into ls_doc_change-obj_descr.
          endif.
          while offset <= size.
            offset_old = offset.
            offset = offset + 250.
            if offset > size.
              temp_len = strlen( iv_content+offset_old ).
              clear ls_data-line.
              ls_data-line = iv_content+offset_old(temp_len).
            else.
              ls_data-line = iv_content+offset_old(250).
            endif.
            concatenate '&KEY&' ls_data-line into ls_data-line.
            append ls_data to lt_data.
          endwhile.
        endif.
        ls_doc_change-doc_size = size.
       l_object_hd_change-objnam = ls_doc_change-obj_name.
        l_object_hd_change-objdes = ls_doc_change-obj_descr.
        l_object_hd_change-objsns = ls_doc_change-sensitivty.
        l_object_hd_change-objla  = ls_doc_change-obj_langu.
        l_object_hd_change-objlen = ls_doc_change-doc_size.
      endif.
    save object
      call function 'SO_OBJECT_INSERT'
           exporting
                folder_id                  = l_folder_id
               OBJECT_FL_CHANGE           = OBJECT_FL_CHANGE
                object_hd_change           = l_object_hd_change
                object_type                = l_obj_type
               ORIGINATOR_ID              = OWNER_ID
              OWNER                      = USER-USRNAM
           importing
               OBJECT_FL_DISPLAY          = OBJECT_FL_DISPLAY
               OBJECT_HD_DISPLAY          = OBJECT_HD_DISPLAY
                object_id                  = ls_object_id   "l_doc_info-object_id
           tables
                objcont                    = lt_data
                objhead                    = lt_obj_header
               OBJPARA                    = OBJECT_PARA
               OBJPARB                    = OBJECT_PARB
           exceptions
                component_not_available    = 01
                folder_not_exist           = 06
                folder_no_authorization    = 05
                object_type_not_exist      = 17
                operation_no_authorization = 21
                parameter_error            = 23
                others                     = 1000.
      if sy-subrc <> 0.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 into ls_message-message.
        ls_message-type = sy-msgty.
        ls_message-id = sy-msgid.
        ls_message-number = sy-msgno.
        ls_message-message_v1 = sy-msgv1.
        ls_message-message_v2 = sy-msgv2.
        ls_message-message_v3 = sy-msgv3.
        ls_message-message_v4 = sy-msgv4.
        append ls_message to rt_messages.
        return.
      endif.
    create relation
      data l_obj_rolea type borident.
      data l_obj_roleb type borident.
    MOVE-CORRESPONDING wd_this->ms_lporb to l_obj_rolea.
      l_obj_rolea-objkey = is_lporb-instid.
      l_obj_rolea-objtype = is_lporb-typeid.
      l_obj_rolea-logsys = is_lporb-catid.
      l_object_id_fol  = l_folder_id.
      l_object_id = ls_object_id.
      concatenate l_object_id_fol l_object_id into l_obj_roleb-objkey respecting blanks.
      l_obj_roleb-objtype = 'MESSAGE'.
      clear l_obj_roleb-logsys.
      call function 'BINARY_RELATION_CREATE'
        exporting
          obj_rolea    = l_obj_rolea
          obj_roleb    = l_obj_roleb
          relationtype = l_retype
        exceptions
          others       = 1.
      if sy-subrc = 0.
        commit work and wait.
       wd_this->MV_UPDATE_FLAG = 'X'.
      else.
        message id sy-msgid type sy-msgty number sy-msgno
                with sy-msgv1 sy-msgv2 sy-msgv3 sy-msgv4 into ls_message-message.
        ls_message-type = sy-msgty.
        ls_message-id = sy-msgid.
        ls_message-number = sy-msgno.
        ls_message-message_v1 = sy-msgv1.
        ls_message-message_v2 = sy-msgv2.
        ls_message-message_v3 = sy-msgv3.
        ls_message-message_v4 = sy-msgv4.
        append ls_message to rt_messages.
        return.
      endif.
    endmethod.
    Edited by: Reyleene Hunt on May 26, 2009 10:05 AM

  • How to load flat file in BPS through Web-debugging

    Hi,
    We are working on flat file upload in BPS thru guide 'How to load flat file in BPS through Web'. Can some one guide on how to debug the function modules used while uploading the data.
    We have set up the break point in the function modules and also in the BSP page. But when trying to debug while uploading, it is not going to the break point which was set.
    Could you assist in setting up the break point.
    Regards,
    Sreenath
    Message was edited by:
            sreenath reddy

    Hi,
    I  have put an external break-point.
    I have hard coded it in the coding of the function module itself.
    The code is perfectly working. But, when I want to check for the values of the variables in the F.M during runtime, the break-point is not triggering. Any ideas??
    Regards,

  • Strange problem of Pdf downloading  with Web Dynpro

    Hi, experts, I have to setup a project to realize pdf downloading with web dynpro. But unluckily, I have tried all the methods in this froum ,there's really strange problem .Because when I click the link of Download UI link, there's no reaction at all, I really don't know why.Below is the codes I used , can anyone help me ? thank you very much!
    public void wdDoInit()
        //@@begin wdDoInit()
              IWDAttributeInfo attInfo =
                   wdContext
                        .currentContextElement()
                        .node()
                        .getNodeInfo()
                        .getAttribute(
                        "Pdfsource");
              ISimpleTypeModifiable type = attInfo.getModifiableSimpleType();
              IWDModifiableBinaryType binaryType = (IWDModifiableBinaryType) type;
              binaryType.setFileName("test.pdf");
              binaryType.setMimeType(WDWebResourceType.PDF);
              try {
                   int length =
                        (int) wdContext.currentPdfdownloadElement().getBin_Filesize();
                   byte b[] = new byte[length];
                   b = wdContext.currentPdfdownloadElement().getBin_File();
                   wdContext.currentContextElement().setPdfsource(b);
              } catch (Exception ex) {
    "Pdfsource" is the context value attribute of type binary.And Bin_File is the xstring type parameter from my RFC contains pdf content.
    I used two views and one customer-controller . I put some value in the first view to set search condition.and the second then appears and have the download UI element. Are there any additional codes I should use? pls help!

    Hi Hao,
    Try this out
    Suppose the file name is test.doc in c drive in server
    create a context attribute filedata of binary type
    bind it to data property
    write the following code
    try
       File input = new File("C:
    test.doc");
       int length =(int)input.length();
       //Create a byte array b to hold the file
       byte b[] = new byte[length];
       FileInputStream in = new FileInputStream(input);
       //Reading the file to a byte array b
       in.read(b);            
       in.close();
       //Setting the data from the byte array to the context element.
       wdContext.currentContextElement().setfiledata(b);
    catch(Exception ex)
      wdComponentAPI.getMessageManager().reportSuccess("Error in File 
      IO"+ex.toString());
    // Structure information of the context attribute
    IWDAttributeInfo attinfo = wdContext.getNodeInfo().getAttribute("filedata");
    IWDModifiableBinaryType binaryType = (IWDModifiableBinaryType) attinfo.getModifiableSimpleType();
    // Default File name which appears when opened on client machine
    binaryType.setFileName("testing.doc");
    //Explicitly setting the file type
    binaryType.setMimeType(WDWebResourceType.DOC);

  • How to save file in km using web dynpro abap

    Hi Experts,
    We have a requirement that file should be saved in a folder in km, the name of the folder should be the employee number.
    Could you please tell me how to create folder with employee number in KM and store file in it using web dynpro abap.
    Thanks and Regards,
    Santhoshi.

    Thanks Naga Raju Meesala.
    How come all these methods are deprecated...getEP5User
    Also, since I am building a weddynpro DC, what is the proper way to include these jar files as Used DCs?
    Now proceed in the same way with the variable PORTAL_HOME and add the following .jar files:
    u2022 \lib\prtapi.jar The portal runtime APIs
    u2022 \portalapps\com.sap.portal.usermanagement\lib\com.sap.security.api.ep5.jar The user management APIs of the Enterprise Portal 5.0 are deprecated, but still in use in SAP NetWeaver 04
    u2022 \portalapps\com.sap.netweaver.bc.rf\lib\bc.rf.framework_api.jar KM Repository Framework APIs
    u2022 \portalapps\com.sap.netweaver.bc.rf.service\lib\bc.rf.global.service.urlgenerator_api.jar Repository Framework Utility: URL Generator
    u2022 \portalapps\com.sap.netweaver.bc.sf\lib\bc.sf.framework_api.jar Repository Framework: Repository Services
    u2022 \portalapps\com.sap.netweaver.bc.util\lib\bc.util.public_api.jar Repository Framework Utilities

  • File Upload/Download

    Hi
    When using the file upload/download functionality, APEX stores the uploaded object in a table by default. See: http://download-uk.oracle.com/docs/cd/B31036_01/doc/appdev.22/b28839/up_dn_files.htm#CJAHDJDA
    Is there a way to specify that the file should NOT be stored in a table, but rather, be stored on the file system?. Example in a directory object location.
    I intend to use the upload/download functionality to load csv files that will then be parsed as external tables.
    Thanks
    Kezie

    Hi,
    I modified the above procedure to point to my tables and trying to create the procedure in Apex database and am getting the following error:
    Procedure:
    CREATE OR REPLACE PROCEDURE write_blob_to_file
    ( p_docid IN NUMBER,
    p_directory IN VARCHAR2,
    p_filename IN VARCHAR2 DEFAULT NULL )
    IS
    l_file utl_file.file_type;
    l_buffer RAW(32767);
    l_amount BINARY_INTEGER := 32767;
    l_position INTEGER := 1;
    l_blob BLOB;
    l_length INTEGER;
    l_filename VARCHAR2(400);
    BEGIN
    SELECT BLOB_CONTENT, MPP_name
    INTO l_blob, l_filename
    FROM MPP_FILES
    WHERE id = p_docid;
    IF p_filename IS NOT NULL THEN
    l_filename := p_filename;
    END IF;
    l_length := dbms_lob.getlength( l_blob );
    l_file := utl_file.fopen( p_directory, l_filename, 'wb', 32767 );
    WHILE l_position < l_length LOOP
    dbms_lob.read( l_blob, l_amount, l_position, l_buffer );
    utl_file.put_raw( l_file, l_buffer, TRUE );
    l_position := l_position + l_amount;
    END LOOP;
    utl_file.fclose( l_file );
    EXCEPTION
    WHEN others THEN
    IF utl_file.is_open( l_file ) THEN
    utl_file.fclose( l_file );
    END IF;
    raise_application_error( -20001, SQLERRM );
    END write_blob_to_file;
    Error:
    ERROR at line 6: PLS-00201: identifier 'UTL_FILE' must be declared
    4. p_filename IN VARCHAR2 DEFAULT NULL )
    5. IS
    6. l_file utl_file.file_type;
    7. l_buffer RAW(32767);
    8. l_amount BINARY_INTEGER := 32767;
    Please let me know what am i missing. I am pretty new to PL/SQL and Apex.
    Also wondering is there a way to download files from tables using Java Stored Procedure. Please give some pointers.
    Ramesh K

  • File upload, download using ADF UIX and not JSP

    I have examples for the file upload, download using JSP
    But I want to use ADF UIX. Look and feel in this is impressing and I want to use this. Any one have example for this.
    Users will select a file from their desktop
    This will be stored into the database (Any document. Word, Excel)
    When they query the records then the UIX column need to give a hyperlink. Clicking on the link should prompt to download the file to the local system

    Sure, I use the Apache Commons File Upload package, so that is what I will discuss here ( [Commons File Upload|http://commons.apache.org/fileupload/] ).
    The Commons File Upload uses instances of ProgressListener to receive upload progress status. So first create a simple class that implements ProgressListener:
    public class ProgressListenerImpl implements ProgressListener {
        private int percent = 0;
        public int getPercentComplete() {
            return percent;
        public void update(long pBytesRead, long pContentLength, int pItems) {
            if (pContentLength > -1) { //content length is known;
                percent = (new Long((pBytesRead / pContentLength) * 100)).intValue();
    }So in your Servlet that handles file upload you will need to create an instance of this ProgressListenerImpl, register it as a listener and store it in the session:
    ServletFileUpload upload = new ServletFileUpload();
    ProgressListenerImpl listener = new ProgressListenerImpl();
    upload.setProgressListener(listener);
    request.getSession().setAttribute("ProgressListener", listener);
    ...Now create another servlet that will retrieve the ProgressListenerImpl, get the percent complete and write it back (how you actually write it back is up to you, could be text, an XML file, a JSON object, up to you):
    ProgressListenerImpl listener = (ProgressListenerImpl) request.getSession().getAttribute("ProgressListener");
    response.getWriter().println("" + listener.getPercentComplete());
    ...Then your XMLHttpRequest object will call this second servlet and read the string returned as the percent complete.
    HTH

  • Urgent : file upload / download functionality in oracle portal page

    Hi friends
    I am new to portal development and am working on oracle portal 9i rel2 . I need to know how to put the file upload and download functionality in any page. the functionality given in oracle portal user guide is not user friendly (i.e in the content area add item of type file" ) .... i need to now is their any way to achieve the simple , one button click upload download functionality ..like we do in yahoo mails etc.
    any help will be highly appreciated.
    regards
    Dheeraj

    Well, I do not know the exact location of the document, however you can find the document to do this in modplsql User Guide ..(File Upload/Download).
    I am pasting some hint:
    e.g.
    Create an html form..code something like this:
    <html>
    <head>
    <title>test upload</title>
    </head>
    <body>
    <FORM      enctype="multipart/form-data"
    action="pls/mydad/write_info"
    method="POST">
    <p>Author's Name:<INPUT type="text" name="who">
    <p>Description:<INPUT type="text" name="description"><br>
    <p>File to upload:<INPUT type="file" name="file"><br>
    <p><INPUT type="submit">
    </FORM>
    </body>
    </html>
    Create a table
    (who varchar2(..).
    description varchar2(..),
    file varchar2(..));
    Your procedure something like this:
    procedure write_info (
    who in varchar2,
    description in varchar2,
    file in varchar2) as
    begin
    insert into myTable values (who, description, file);
    htp.htmlopen;
    htp.headopen;
    htp.title('File Uploaded');
    htp.headclose;
    htp.bodyopen;
    htp.header(1, 'Upload Status');
    htp.print('Uploaded ' || file || ' successfully');
    htp.bodyclose;
    htp.htmlclose;
    end;
    You should be able to download/access the file using the following URL format:
    http://<host>:<port>/pls/<dad>/docs/<file_name>
    Where file name is = Look for the value in the "myTable" > file.
    Do tell how you get on this.
    Thanx,
    Chetan.

  • How to send a mail through web dynpro application

    Hi
    How to send a mail through web dynpro application?
    Thanks

    Hi ,
      Please post some more details about your query .
    One way is to can use LinkToUrl UI element and in the reference property of the UI element , give it as mailto:mail addess
    Thanks.
    aditya.

  • Search for users in a particular LDAP through Web Dynpro code...

    Hi Experts,
    Let me try explaining my problem. In my project we are using two ADAM LDAPs. One for storing internal users and the other for storing external users. I have configured the portal to connect to both the LDAPs. I am able to search for the users created in both the LDAPs through portal Indentity Management.
    I am trying to search for the users in a specific LDAP through Web Dynpro coding... I am not lucky enough to get it done. Let me explain you what I did.
    I created a custom attribute for UME through config tool. Gave a physical mapping for the custom attribute in dataSourceConfig_xxx.xml to the LDAP attribute distinguishedName which returns the distinguished Name for the user in ADAM LDAP.
    For Example: Custom attribute in UME is ldapuser which is mapped to distinguishedName attribute in ADAM LDAP in dataSourceConfig_xxx.xml.
    When I do a search for the users in a particular LDAP, I am trying to put a filter to the newly created ldapuser attribute to distinguish between the two LDAPs.
    The search will result if I pass the value as '*'. If I try to specify the user path for the LDAP in this attribute it doesnt result any data.
    For example:
    userSearchFilter.setSearchAttribute(
         "com.sap.com.cust.admn",
          "ldapuser",
         "OU=16482515,OU=Members",
         ISearchAttribute.LIKE_OPERATOR,
         false);
    The above code will not return the data, whereas
    userSearchFilter.setSearchAttribute(
         "com.sap.com.cust.admn",
          "ldapuser",
         ISearchAttribute.LIKE_OPERATOR,
         false);
    Will result with user list from both the LDAPs.
    If anyone tried searching for users in a particular LDAP through code, please help me with this issue.
    Thank you in advance.
    Regards,
    Rekha Malavathu

    I just figured it out. Under "group-policy GroupPolicy_COMPANY_SSL_VPN attributes", I had to add "vpn-simultaneous-logins 15". Apparently, it was using the value "vpn-simultaneous-logins 0" under the NOACCESS group policy.

  • File Upload/Download storing in ECC

    hi Guys,
    Using webdynpro abap application I am uploading a file.I want to store this file in the backend database(R/3). I am not able to stroe the Xstring value to the table.
    So I have made my table with field with  data type as string.
    Is there an standard function module to convert Xstring to String.
    Because in another webdynpro application I want to download the file which was uploaded so we require a function module to convert string to xstring again.
    Tell me how to store the Xstring data of the file to database tabel and agian download it.
    Regards,
    Shamila.

    Hi,
    Chek this standard document
    http://help.sap.com/saphelp_nw70/helpdata/EN/b3/be7941601b1d09e10000000a155106/frameset.htm
    Also check these forum threads
    Re: download a file
    File Upload/Download
    File download in Local PC
    Re: File Download to Excel
    for file upload control you can look at WDR_TEST_EVENTS component

Maybe you are looking for

  • Filedownload UI element not working in production

    Hi, There is filedownload UI element used along with a dropdown UI element This is working fine in dev and quality but in production it doesnt pick the file. It is made to work as follows - u2022     first of all the files are placed at root location

  • Issue in Email link in CRM .

    Hi All , We are facing an  issue when a link to a u2018Service Messageu2019 is sent through Lotus Notes. When the user clicks on the link a dump comes up  We are able to access the standard BSP application  DSWP_BSP,  but when we try to open a servic

  • Tree creation failed on node: pcd:portal_content/...

    Hi out there, after patching our EP 7 from SPS 10 to SPS 13 we have the following error: In the portal content directory there are some folders which cannot be expanded anymore. The following error message appears: "Could not load or refresh node Tre

  • Goods receipt prurchase order

    I have created a purchase order and i want to create a "goods receipt purchase order" i am using transaction code: MIGO. I imported the purchase order i created which displays all the information i need but when i post it, i get the following error:

  • IPhone contacts list somehow replaced by iPad contacts list

    I bought an iPad for my wife.  Put in her old email address and from that added email addresses to her "contacts".  I turned on my iPhone and found my "contacts" had been replaced by hers.  Very weird.  I need to know how it happened, how to avoid it