File Upload / Download - Advice Required

Hi all,
This is really just a general question, looking for advice.
I have downloaded and successfully used the File Upload PJC for Forms 6i - thanks Oracle.
We are looking to use this to download and upload files from or to the client machine, and I am (relatively) confident of reversing the Java components to allow this to happen.
However, we are actually looking to transfer the files from the client machine, to the 9iAS Tier and then to the UNIX (AIX) tier where the database (8.1.7.4) resides - and vice versa.
I have considered a couple of different approaches :
1. Run the Java Server component in the Database JVM to enable the writing/reading of files on the UNIX filesystem.
2. Use TEXT_IO on the 9iAS tier, and UTL_FILE on the Database Tier, to move files between the two tiers.
3. Write the files to / from the Database, and then from/to there into the UNIX filesystem.
Does anyone have any expereince of attempting to implement a similar solution, or information on Oracle documentation explaining any of the above.
Plus, I'm sure I must be missing a trick !
Any other ideas ??
Regards
Marc Ludwig

We have build a similar solution,
for the download:
we use the pl/sql gateway to send the file to the client with the following function:
wpg_docload.download_File(lob_loc);
you could build a pl/sql procedure that accepts an id and selects the blob locater and
triggers this function. the procedure can be called by setting the configuration in your DAD correctly.
that way its easier then rebuilding the whole fileupload utility.
in the webforms you can have a code that opens a new window with an url you give.
the url will point to the pl/sql function and you can pass the id of the record you want to get the blob from.
for the upload to your database:
well, we chose to loose the zip functionality and modify the pl/sql library that comes with it.
instead of using the uploadserver class, you could build a pl/sql function in the database that
accepts the varchar32 strings (which are base64encoded chunks of your file) and appends them to a blob.
the function that could do that would look like:
PROCEDURE APPEND_DATA(P_ID IN NUMBER, P_DATA IN VARCHAR2) IS
bin_data blob;
append_data blob;
raw_data raw(16384);
BEGIN
dbms_lob.CREATETEMPORARY(append_data,true);
dbms_lob.OPEN(append_data,DBMS_LOB.LOB_READWRITE);
select binary_data into bin_data from ibs_physical_doc where id=P_ID for update;
raw_data:= utl_encode.BASE64_DECODE(utl_raw.CAST_TO_RAW(p_data));
dbms_lob.write(append_data, utl_raw.LENGTH(raw_data),1,raw_data);
dbms_lob.APPEND(bin_data,append_data);
dbms_lob.CLOSE(append_data);
COMMIT;
END;
you can increase the chunksize a bit more.
you still have a problem btw that you probably cant upload more then 4-8 mb before you get an out of memory error on the client.
you could solve that by rewriting the client java file to send the file piece by piece on request by the server instead of all the pieces after eachother, and first read a piece of the file and then encode that piece and then send it instead of reading the whole file, encoding it and sending the chunks.
Another option is to use the standard upload possibilties with web pl/sql, and open a new browser window to that window from forms. A drawback of that is that it is not integrated in the web forms program and that you cant see when the upload is finished (no callback). and that you are bound to the default table layout.
one final thing, if you are going to use this, you might want to take a look at using JInitiator 1.3.1.9 if you arent using it already this automaticly sets the signature in the clients database if he accepts it. there is a bug in it, look for it somewhere in this forum. if you are using the sample that comes with forms 6i you will have to replace the fileuploadprogressbar with the one that comes with the forms 9i sample and recompile everything and i think you will have to use JDK1.3.1_03 for that. that means that you will have to modify the make batch file. the command for compiling is different, the classpath is an option when you call javac, also you will have to sign it with jarsigner.exe (in the jdk) instead of the one in the example.
Hope this info is helpfull, if you like to have more specific code, mail me at [email protected]

Similar Messages

  • 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

  • 2-way file upload/download b/w client/server

    I need help for a good design strategy for 2-way file upload/download betweeen client and server.
    I have to upload a set of files to the server (which is a servlet)
    and again the servlet downloads another set of files to the client (which is an applet)
    I could find a solution to this problem only to a certain extent (i.e) I can upload any no.of files to the servlet from applet but the servlet can download only a single file to the applet.
    But now the requirement needs the servlet to be able to send more than one file. I am not going anywhere ahead from this point since last 2 days.
    I have used ObjectOutputStream-ObjectInputStream objects at both ends for communcation and sending the files as bufferes of 128 size. But this is becoming more complicated to manage the streams!!
    if anyone of you have done this before please help with this!
    Thaks
    sri

    Give this a try.
    1) construct
    2) call ZipDocVO.add(Serializable) for each obj that you wish to send.
    3) call ZipDocVO.zip() to zip it up when you are finished adding objects.
    4) send the ZipDocVO, using ObjectOuputStream or whatever
    5) call ZipDocVO.unzip()
    6) call ZipDocVO.getDocuments() to access your objects
    import java.io.*;
    import java.util.zip.*;
    import java.util.*;
    public class ZipDocVO implements Serializable {
         private List     vos;
         private byte[]     rawData;
         private boolean     isZipped;
         public ZipDocVO( byte botype, int key )
              vos = new ArrayList();
         public List getDocuments() { return vos; }
         public void add( Serializable doc ) { vos.add( doc ); }
         private boolean isZipped() { return isZipped; }
         public void zip() {
              if( isZipped() ) {
                   System.out.println( "Already zipped!" );
              else {
                   try {
                        // First zip our documents
                        ByteArrayOutputStream baos = new ByteArrayOutputStream();
                        GZIPOutputStream gzos = new GZIPOutputStream( baos );
                        ObjectOutputStream oos = new ObjectOutputStream( gzos );
                        oos.writeObject( vos );
                        oos.close();
                        // Then get rid of the unzipped versions
                        rawData = baos.toByteArray();
                        vos = null;
                        isZipped = true;
                   catch( IOException ioe ) {
                        System.out.println( "Unable to zip : " +ioe.getMessage());
         public void unzip() {
              if( !isZipped() ) {
                   System.out.println( "Not zipped!" );
              else {
                   try {
                        // First unzip our documents
                        ByteArrayInputStream bais = new ByteArrayInputStream( rawData );
                        GZIPInputStream gzis = new GZIPInputStream( bais );
                        ObjectInputStream ois = new ObjectInputStream( gzis );
                        vos = (ArrayList)ois.readObject();
                        ois.close();
                        // Then get rid of the zipped versions
                        rawData = null;
                        isZipped = false;
                   catch( Exception e ) {
                        System.out.println( "Unable to unzip : " +e.getMessage());
    }

  • 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.

  • File Uploads/Downloads

    I have an HP Pavillion Desktop with Windows 7 operating system. I think one of my children has disabled something because when I click on anything to do a file upload/download, I can't access my Desktop or any files on it. Help!

    Hi,
    The easiest way to solve this may be to run Windows System Restore.  First, copy any files currently on your Desktop, paste them into a new folder, then cut and paste the folder in to your Documents folder.
    Once you've done this, shut down the PC.  Windows System Restore is usually best run in Safe Mode.  Tap away at f8 as you start the PC to enter Windows Recovery Console.  Use the arrow keys to select Safe Mode and hit enter.  When this has loaded, from the Start Menu, click All Programs, click Accessories, click System Tools and launch System Restore.  Pick a restore point before at least 24 hours before this issue and then proceed with the restore process.  When complete, Windows will reboot as normal.
    Regards,
    DP-K
    ****Click the White thumb to say thanks****
    ****Please mark Accept As Solution if it solves your problem****
    ****I don't work for HP****
    Microsoft MVP - Windows Experience

  • File Upload/Download Problem

    Hi,
    I have a fileupload button. The attributes type is XSTRING, which i bound it with "data" property of download.
    When i download this file with "download" element, it comes in a zip file and as XML files. Only the jpg files are downloaded correctly.
    How can i solve this?
    Thanks.

    Hi,
    I am so sory for my very late answer.
    If you want to upload/download files, you should have a node which includes attributes
    (attribute names are just example ):
    1) filename(type: for example afilename),
    2)mimetype (type : string),
    3) file(type : a data element with type 'RAWSTRING').
    You must match your fileupload element's attributes with them:
    "DATA" attribute --> file ,
    "fileNAME" attribute--> filename,
    "mimeTYPE" attritube -->mimetype.
    When you want to download this file, you should put a filedownload element and match this element's attributes with the node's attributes which i described above.

  • File uploading / downloading

    hello all,
    can any one explain me about file uploading and downloading.
    how the FM's GUI_UPLOAD and DOWNLOAD works,
    also why we do not use the FM's WS_UPLOAD
    if any material regarding this plz mail me at [email protected]
    thanks for help in advance.
    vikas

    Hi vikas,
    there  r 3 function modules for downloading the data from internal(dictionary)
    tables into the files in application server.
    1.DOWNLOAD
    2.WS_DOWNLOAD
    3.GUI_DOWNLOAD
    just hv a look on the following code.
    TABLES: VBAK,VBAP.
    DATA: BEGIN OF I_VBAK OCCURS 0,
          VBELN LIKE VBAK-VBELN,
          ERDAT LIKE VBAK-ERDAT,
          ERNAM LIKE VBAK-ERNAM,
          AUDAT LIKE VBAK-AUDAT,
          VBTYP LIKE VBAK-VBTYP,
          END OF I_VBAK.
    DATA: BEGIN OF I_VBAP OCCURS 0,
          VBELN LIKE VBAP-VBELN,
          POSNR LIKE VBAP-POSNR,
          MATNR LIKE VBAP-MATNR,
          CHARG LIKE VBAP-CHARG,
          MATKL LIKE VBAP-MATKL,
          END OF I_VBAP.
    DATA: BEGIN OF IT_VBAK OCCURS 0,
          VBELN LIKE VBAK-VBELN,
          ERDAT LIKE VBAK-ERDAT,
          ERNAM LIKE VBAK-ERNAM,
          AUDAT LIKE VBAK-AUDAT,
          VBTYP LIKE VBAK-VBTYP,
          POSNR LIKE VBAP-POSNR,
          MATNR LIKE VBAP-MATNR,
          CHARG LIKE VBAP-CHARG,
          MATKL LIKE VBAP-MATKL,
          END OF IT_VBAK.
    SELECT VBELN ERDAT ERNAM AUDAT VBTYP FROM VBAK INTO TABLE I_VBAK.
    SELECT VBELN POSNR MATNR CHARG MATKL FROM VBAP INTO TABLE I_VBAP.
    SORT: I_VBAK BY VBELN,I_VBAP BY VBELN.
    LOOP AT I_VBAK.
    READ TABLE I_VBAP WITH KEY VBELN = I_VBAK-VBELN BINARY SEARCH.
    IF SY-SUBRC = 0.
      MOVE I_VBAK-VBELN TO IT_VBAK-VBELN.
      MOVE I_VBAK-ERDAT TO IT_VBAK-ERDAT.
      MOVE I_VBAK-ERNAM TO IT_VBAK-ERNAM.
      MOVE I_VBAK-AUDAT TO IT_VBAK-AUDAT.
      MOVE I_VBAK-VBTYP TO IT_VBAK-VBTYP.
      MOVE I_VBAP-POSNR TO IT_VBAK-POSNR.
      MOVE I_VBAP-MATNR TO IT_VBAK-MATNR.
      MOVE I_VBAP-CHARG TO IT_VBAK-CHARG.
      MOVE I_VBAP-MATKL TO IT_VBAK-MATKL.
    APPEND IT_VBAK.
    ENDIF.
    ENDLOOP.
    *& IT ASKS THE CONFIRMATION FOR THE FILE FORMATE,WE CAN CHANGE THE FILENAME DYNAMICALLY(e.g DOC-TXT,XLS)
    *CALL FUNCTION 'DOWNLOAD'
    EXPORTING
      BIN_FILESIZE                  = ' '
      CODEPAGE                      = ' '
      FILENAME                      = 'D:\C1.TXT'
      FILETYPE                      = 'DAT'   "ASC is also another format
      ITEM                          = ' '
      MODE                          = ' '
      WK1_N_FORMAT                  = ' '
      WK1_N_SIZE                    = ' '
      WK1_T_FORMAT                  = ' '
      WK1_T_SIZE                    = ' '
      FILEMASK_MASK                 = '.TXT'
      FILEMASK_TEXT                 = ' '
      FILETYPE_NO_CHANGE            = 'X'
      FILEMASK_ALL                  = ' '
      FILETYPE_NO_SHOW              = 'X'     "THIS WILL NOT SHOW THE FILE TYPE(DAT) WHILE CONFIRMATION OF FILE NAME
      SILENT                        = 'S'
      COL_SELECT                    = ' '
      COL_SELECTMASK                = ' '
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      ACT_FILENAME                  =
      ACT_FILETYPE                  =
      FILESIZE                      =
      CANCEL                        =
    TABLES
       DATA_TAB                      = IT_VBAK
      FIELDNAMES                    =
    EXCEPTIONS
      INVALID_FILESIZE              = 1
      INVALID_TABLE_WIDTH           = 2
      INVALID_TYPE                  = 3
      NO_BATCH                      = 4
      UNKNOWN_ERROR                 = 5
      GUI_REFUSE_FILETRANSFER       = 6
      OTHERS                        = 7
    *IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
    *& this will not ask for the confirmation for the filename
    *CALL FUNCTION 'WS_DOWNLOAD'
    EXPORTING
      BIN_FILESIZE                  = ' '
      CODEPAGE                      = ' '
      FILENAME                      = 'D:\C2.DOC'
      FILETYPE                      = 'DAT'
      MODE                          = ' '
      WK1_N_FORMAT                  = ' '
      WK1_N_SIZE                    = ' '
      WK1_T_FORMAT                  = ' '
      WK1_T_SIZE                    = ' '
      COL_SELECT                    = ' '
      COL_SELECTMASK                = ' '
      NO_AUTH_CHECK                 = ' '
    IMPORTING
      FILELENGTH                    =
    TABLES
       DATA_TAB                      = IT_VBAK
      FIELDNAMES                    =
    EXCEPTIONS
      FILE_OPEN_ERROR               = 1
      FILE_WRITE_ERROR              = 2
      INVALID_FILESIZE              = 3
      INVALID_TYPE                  = 4
      NO_BATCH                      = 5
      UNKNOWN_ERROR                 = 6
      INVALID_TABLE_WIDTH           = 7
      GUI_REFUSE_FILETRANSFER       = 8
      CUSTOMER_ERROR                = 9
      NO_AUTHORITY                  = 10
      OTHERS                        = 11
    *IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    *ENDIF.
    CALL FUNCTION 'GUI_DOWNLOAD'
      EXPORTING
      BIN_FILESIZE                    =
        FILENAME                        = 'D:\C5.DOC'
       FILETYPE                        = 'ASC'  "Separate Columns by Tabs in Case of ASCII Download
      APPEND                          = ' '
       WRITE_FIELD_SEPARATOR           = 'X'
      HEADER                          = '00'
      TRUNC_TRAILING_BLANKS           = ' '
      WRITE_LF                        = 'X'
      COL_SELECT                      = ' '
      COL_SELECT_MASK                 = ' '
      DAT_MODE                        = ' '
        CONFIRM_OVERWRITE               = 'X' "Overwrite The File Only After
                        Confirmation                          
      NO_AUTH_CHECK                   = ' '
      CODEPAGE                        = ' '
      IGNORE_CERR                     = ABAP_TRUE
      REPLACEMENT                     = '#'
      WRITE_BOM                       = ' '
      TRUNC_TRAILING_BLANKS_EOL       = 'X'
      WK1_N_FORMAT                    = ' '
      WK1_N_SIZE                      = ' '
      WK1_T_FORMAT                    = ' '
      WK1_T_SIZE                      = ' '
      WRITE_LF_AFTER_LAST_LINE        = ABAP_TRUE
    IMPORTING
      FILELENGTH                      =
      TABLES
        DATA_TAB                        = IT_VBAK
      FIELDNAMES                      =
    EXCEPTIONS
      FILE_WRITE_ERROR                = 1
      NO_BATCH                        = 2
      GUI_REFUSE_FILETRANSFER         = 3
      INVALID_TYPE                    = 4
      NO_AUTHORITY                    = 5
      UNKNOWN_ERROR                   = 6
      HEADER_NOT_ALLOWED              = 7
      SEPARATOR_NOT_ALLOWED           = 8
      FILESIZE_NOT_ALLOWED            = 9
      HEADER_TOO_LONG                 = 10
      DP_ERROR_CREATE                 = 11
      DP_ERROR_SEND                   = 12
      DP_ERROR_WRITE                  = 13
      UNKNOWN_DP_ERROR                = 14
      ACCESS_DENIED                   = 15
      DP_OUT_OF_MEMORY                = 16
      DISK_FULL                       = 17
      DP_TIMEOUT                      = 18
      FILE_NOT_FOUND                  = 19
      DATAPROVIDER_EXCEPTION          = 20
      CONTROL_FLUSH_ERROR             = 21
      OTHERS                          = 22
    IF SY-SUBRC <> 0.
    MESSAGE ID SY-MSGID TYPE SY-MSGTY NUMBER SY-MSGNO
            WITH SY-MSGV1 SY-MSGV2 SY-MSGV3 SY-MSGV4.
    ENDIF.
    if u need any help abt this one,i welcome u to clarify them.
    reward points,if it is useful.

  • 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

  • File Upload/Download buttons in Table UI

    Dear Experts,
    I want to give file upload and download buttons in the columns of the Table UI element. I'm not able to achieve upload file with browse functionality on the click and Download file with ws_execute functionality.
    If anybody can throw some light, it would be of great help.
    I'm sort of a intermediate level developer in WD for ABAP.
    Regds,
    Aryan.

    Hi Aryan,
    In order to get the download functionality. Create an button in the Table toolbar and put the below coding into it. You need to basically do the following tasks:
    1) First read the table's data into an internal table.
    2) Convert the internal table data to STRING format.
    3) Now convert it into tab delimited format.
    4) Convert this STRING format to XSTRING format
    5) Make use of the attach_file_to_response method.
    Regards,
    Uday
    You can also go through this [link|http://****************/Tutorials/WebDynproABAP/Export/toexcel.htm] for a similar example.
    METHOD onactionon_submit .
      DATA: lv_node TYPE REF TO if_wd_context_node,
            lt_mara TYPE if_main=>elements_mara,
            wa_mara TYPE if_main=>element_mara,
            lead_selection_index TYPE i,
            mara_string  TYPE string,
            mara_xstring TYPE xstring.
      lv_node = wd_context->get_child_node( name = 'MARA' ).
      CALL METHOD lv_node->get_static_attributes_table
        IMPORTING
          table = lt_mara.
      LOOP AT lt_mara INTO wa_mara.
        CONCATENATE mara_string
                    wa_mara-matnr
                    wa_mara-ersda
                    wa_mara-ernam
                    wa_mara-matkl
                    wa_mara-meins
                    cl_abap_char_utilities=>newline INTO mara_string
                                            SEPARATED BY cl_abap_char_utilities=>horizontal_tab.
      ENDLOOP.
      CALL FUNCTION 'SCMS_STRING_TO_XSTRING'
        EXPORTING
          text   = mara_string
        IMPORTING
          buffer = mara_xstring.
      wdr_task=>client_window->client->attach_file_to_response(  i_filename  = 'TEMP.DOC'
                                                                 i_content   = mara_xstring
                                                                 i_mime_type = 'WORD' ).
    ENDMETHOD.
    The above is the code to export the Internal Table to Word Document. You can proceed as shown below for Excel & NOTEPAD formats.
    To Export the Internal Table to Text File:
    WDR_TASK=>CLIENT_WINDOW->CLIENT->ATTACH_FILE_TO_RESPONSE(
        I_FILENAME    = 'WDP.txt'
        I_CONTENT     =  mara_xstring
        I_MIME_TYPE   = 'NOTEPAD' ).
    To Export the Internal Table to Excel File:
    WDR_TASK=>CLIENT_WINDOW->CLIENT->ATTACH_FILE_TO_RESPONSE(
        I_FILENAME    = 'Excel.xls'
        I_CONTENT     =  mara_xstring
        I_MIME_TYPE   = 'EXCEL' ).

  • File Upload/Download, updating to SAP

    Hi All:
    Has anyone implemented the file upload functionality?
    Could you please share the details.... Iam successfully passing the file name from WD but get short dump with
    "   Termination occurred in the ABAP program "SAPLCNDP" - in
         "DP_CONTROL_ASSIGN_TABLE".
        The main program was "SAPMSSY1 ".
        In the source code you have the termination point in line 1
        of the (Include) program "LCNDPU10"".
    Iam using  "cl_gui_frontend_services=>gui_upload " to upload to SAP.
    Thanks in advance.

    Look at this blog. It may help you:
    <a href="/people/raja.thangamani/blog/2007/11/12/how-to-create-attachments-in-business-transaction-from-webdynprojava attachments in SAP</a>
    <a href="/people/raja.thangamani/blog/2007/11/29/displaydelete-attachment-from-business-transactions-using-webdynpro-java attachment from SAP</a>
    Raja T

  • How to do a file upload & download using Apache Commons FileUpload?

    Hi, I have read through the user guide but I don't understand what are the steps as to implementing the functions...
    http://commons.apache.org/fileupload/using.html
    How do I Create a servlet to read the contents(filename) of te dir where the files are, then create a collection (ArrayList for instance) with the files path and send this collection back to a jsp page.In jsp page, iterate through the collection and build the links (with scriptlets or c tags)
    Can help? Thanks for the guidance!

    This is my single_upload_page.jsp
    <%@ page import="java.io.*" %>
    <%
         //to get the content type information from JSP Request Header
         String contentType = request.getContentType();
         //here we are checking the content type is not equal to Null and
    //as well as the passed data from mulitpart/form-data is greater than or
    //equal to 0
         if ((contentType != null) && (contentType.indexOf("multipart/form-data") >= 0)) {
              DataInputStream in = new DataInputStream(request.getInputStream());
              //we are taking the length of Content type data
              int formDataLength = request.getContentLength();
              byte dataBytes[] = new byte[formDataLength];
              int byteRead = 0;
              int totalBytesRead = 0;
              //this loop converting the uploaded file into byte code
              while (totalBytesRead < formDataLength) {
                   byteRead = in.read(dataBytes, totalBytesRead, formDataLength);
                   totalBytesRead += byteRead;
              String file = new String(dataBytes);
              //for saving the file name
              String saveFile = file.substring(file.indexOf("filename=\"") + 10);
              saveFile = saveFile.substring(0, saveFile.indexOf("\n"));
              saveFile = saveFile.substring(saveFile.lastIndexOf("\\")+ 1,saveFile.indexOf("\""));
              int lastIndex = contentType.lastIndexOf("=");
              String boundary = contentType.substring(lastIndex + 1,contentType.length());
              int pos;
              //extracting the index of file
              pos = file.indexOf("filename=\"");
              pos = file.indexOf("\n", pos) + 1;
              pos = file.indexOf("\n", pos) + 1;
              pos = file.indexOf("\n", pos) + 1;
              int boundaryLocation = file.indexOf(boundary, pos) - 4;
              int startPos = ((file.substring(0, pos)).getBytes()).length;
              int endPos = ((file.substring(0, boundaryLocation)).getBytes()).length;
              // creating a new file with the same name and writing the content in new file
              String folder = "C:/Program Files/Apache Software Foundation/Tomcat 5.5/webapps/ROOT/test/x/";     
              FileOutputStream fileOut = new FileOutputStream(folder + saveFile);     
                             //out.print("Saved here: " + saveFile);     
                             //fileOut.write(dataBytes);     
              fileOut.write(dataBytes, startPos, (endPos - startPos));
              fileOut.flush();
              fileOut.close();
              %><Br><table border="2"><tr><td><b>You have successfully upload the file by the name of:</b>
              <% out.println(saveFile); %></td></tr></table> <%
    %>

  • How to implement File Upload/DownLoad in OA page

    Hi All
    I have to implement the File download feature of OA Framework in my Custom OA page when i click the button.
    In developer's Guide i gone through this but i did'nt get what to set in
    File View Attribute,
    File Name Override,
    File MIME Type,
    and View Attribute
    Please Suggest
    Best regards

    The information is there in the dev guide
    File View Attribute - The view attribute that maps to the column that stores the file content.
    File Name Override - The file name to save to when you select the File Download link and choose the Save option in the File Download window to save the file. The default file name that appears in the File Name field of the Save As dialog window is derived from the value returned from the view
    attribute specified by the View Attribute property. The value of the File Name Override property overrides that default file name and is especially useful if the view attribute returns instructional text, such as "Click on this link to download the file". If the File Name Override property is not defined, then
    the file name to save to is the value returned from the view attribute.
    File MIME Type - The MIME type of the file. See the Runtime Control example below if you do not want to specify a static value for this property.
    Data Type - The data type of the File View Attribute. The BLOB datatype is now supported for File Download as of OA Framework 11.5.10D.

  • I am experiencing constant crashes when pages are loading or files uploading/downloading. Using a MacBook running OS X 10.5.8 and Firefox 3.6.8 - crash id is sqlite3Step. I have cleared history & caches and re-installed, but no change. Any suggestions?

    Problems with Flash content, media files (Facebook photos etc.), streaming media (iPlayer) and MobileMe/iDisk uploads

    Hi Tracy,
    I don't suspect Malware yet, Id guess Disk corruption or failing Hard Drive with Files not found.
    Could be many things, we should start with this...
    "Try Disk Utility
    1. Insert the Mac OS X Install disc, then restart the computer while holding the C key.
    2. When your computer finishes starting up from the disc, choose Disk Utility from the Installer menu at top of the screen. (In Mac OS X 10.4 or later, you must select your language first.)
    *Important: Do not click Continue in the first screen of the Installer. If you do, you must restart from the disc again to access Disk Utility.*
    3. Click the First Aid tab.
    4. Select your Mac OS X volume.
    5. Click Repair Disk, (not Repair Permissions). Disk Utility checks and repairs the disk."
    http://docs.info.apple.com/article.html?artnum=106214
    Then try a Safe Boot, (holding Shift key down at bootup), run Disk Utility in Applications>Utilities, then highlight your drive, click on Repair Permissions, reboot when it completes.
    (Safe boot may stay on the gray radian for a long time, let it go, it's trying to repair the Hard Drive.)
    If perchance you can't find your install Disc, at least try it from the Safe Boot part onward.

Maybe you are looking for

  • Hp Compaq Mini 700-Fatal Error System Halted CNU9122NHV

    Hi I us in my computer Linux Mint i think so but now i start my computer and get this message.. Fatal Error System Halted CNU9122NHV. I am not so good in english are from Sweden..And i hope someone can help me.. Thank you!!

  • USA Mac now based in UK wanting to order UK prints from iPhoto

    Is it possible to change the geographic location so that prints and books from iPhoto can be ordered from different countries. I currently have a laptop with iPhoto 5 that originated from the US and I want to be able to order prints from the UK. By d

  • Help cancelling an event

    I have a component, mentioned in another post (attached here as well), which is canvas component with a two image components in it: one is the "object" itself, and the other is a "close" button. The object has a click handler which brings it to the f

  • Unable to locate any database objects

    Hi, I try to run Query the Inventory Database today with no luck. From ConsoleOne, click Tools, click Configure DB, click a Zenworks database object and OK, I got message"Database is configured" I then try to do Inventory Query, the only choice for S

  • Error Occurred when creating frame (Error -1)

    I have been working on a project in Motion 5 and recently on my 2009 MBP Intel Core 2 Duo and recently upgraded to an Core i7. I transferred all the project files and media over to the new machine but now when I export I get the error message  "The o