How to upload/download file into/from blob column in ADF/JDev 11g.

Hello to all.
I found demo from Kuba user on that page: http://kuba.zilp.pl/?id=1
But that demo is for release 10g and too complicated for me for this time (I'm fish in Jdeveloper).
I can create some simple table view (of form view) with oracle connection with table with blob data.
Blob column will content doc/xls/pdf ...etc.
Now I can add two buttons for download and upload.
What I have to do in next time?
Is it possible to use some component or something?
Thank you
Ben

I was able to accomplish downloading from a blob, but I'm trying to dynamically set the ContentType.
As the table may contain different types of files, I'm setting the ContentType to #{row.Fileext}, where Fileext is set in SQL select as follows:
pseudocode: get file extension, and set the content type based on file extension.
sql select :decode(substr(fdv.file_name,instr(fdv.file_name,'.',-1,1)+1),'log','text/plain; charset=utf-8','xml','text/xml','xls','application/vnd.ms-excel','tif','image/tiff','jpg','image/jpeg','unknown')
I rather use a fuction/method, and tried the following instead:
ContentType = #{backingBeanScope.backing_processReqs.FileAttachContType}
where FileAttachContType =
public class ProcessReqs {
public String FileAttachContType() {
// code to substring filename for extension and decode values
return strContType
But I get the following error:
Error 500--Internal Server Error
          javax.el.PropertyNotFoundException: The class 'sunrider.reqpoportal.view.backing.ProcessReqs' does not have the property 'FileAttachContType'.
               at javax.el.BeanELResolver.getBeanProperty(BeanELResolver.java:547)
               at javax.el.BeanELResolver.getValue(BeanELResolver.java:249)
               at javax.el.CompositeELResolver.getValue(CompositeELResolver.java:143)
Ideas?
PS: Kuba, I've been trying to get to your blog all day, and it would just time out.
Thanks everyone in advance!
-R
Edited by: user6631964 on Jul 24, 2009 5:55 PM

Similar Messages

  • How to upload a file to a BLOB column in the DB using PL/SQL???

    Hi
    I am trying to upload a file to a BLOB column in my database. I wana do this using some pl/sql procedure.I don't wana use webutil. is it possible??? and if so can anybody help me with this???
    Regards
    Shiraz

    Hello,
    This is a stored procedure sample that show how insert into CLOB, BLOB and BFILE columns
    CREATE OR REPLACE PROCEDURE Insert_document
         PC$Type IN DOCUMENT.TYP%TYPE
        ,PC$Nom IN DOCUMENT.NOM_DOC%TYPE
        ,PC$Texte IN VARCHAR2
        ,PC$Image IN VARCHAR2 
        ,PC$Fichier IN VARCHAR2
       ) IS
      L$Blob BLOB;
      L$Clob CLOB;
      L$Bfile BFILE;
      LN$Len NUMBER := dbms_lob.lobmaxsize;
      LN$Num NUMBER ;
      LN$src_off PLS_INTEGER := 1 ;
      LN$dst_off PLS_INTEGER := 1 ;
      LN$Langctx NUMBER := dbms_lob.default_lang_ctx ;
      LN$Warn NUMBER;
      BEGIN
        -- Création of new raw --
        If PC$Fichier is not null Then
           L$Bfile := BFILENAME( 'FICHIERS_IN', PC$Fichier );
        End if ;
        -- Creation of temporary objetcs --
        dbms_lob.createtemporary( L$Clob, TRUE ) ;
        dbms_lob.createtemporary( L$Blob, TRUE ) ; 
        -- Loading text in CLOB column --
        If PC$Texte is not null Then
           L$Bfile := BFILENAME( 'FICHIERS_IN', PC$Texte );
           dbms_lob.fileopen(L$Bfile, dbms_lob.file_readonly);
           If dbms_lob.fileexists( L$Bfile ) = 1 Then
             dbms_output.put_line(PC$Texte || ' open' ) ;
             dbms_lob.loadclobfromfile(
                                       L$Clob,                -- Destination CLOB
                                       L$Bfile,               -- Source file pointer
                                       LN$Len,                -- # bytes to read
                                       LN$src_off,            -- Source start position
                                       LN$dst_off,            -- Target start position
                                       dbms_lob.default_csid, -- CSID
                                       LN$Langctx,            -- Language Context
                                       LN$Warn);              -- Warning message
             dbms_lob.fileclose(L$Bfile);
          Else
             raise_application_error( -20100, 'Erreur ouverture ' || PC$Texte ) ;
          End if ;
        End if ;
        -- Loading image in BLOB column --
        If PC$Image is not null Then
           L$Bfile := BFILENAME( 'FICHIERS_IN', PC$Image );
           dbms_lob.fileopen(L$Bfile, dbms_lob.file_readonly);
           dbms_lob.loadblobfromfile(
                                     L$Blob,       -- BLOB de destination
                                     L$Bfile,      -- Pointeur de fichier en entrée
                                     LN$Len,       -- Nombre d'octets à lire
                                     LN$src_off,   -- Position source de départ
                                     LN$dst_off);  -- Position destination de départ
           dbms_lob.fileclose(L$Bfile);
        End if ; 
        -- Save --
        Insert into DOCUMENT (ID, NOM_DOC, TYP, UTILISE, LOB_TEXTE, LOB_DATA, LOB_FICHIER)
               Values( SEQ_DOCUMENT.NEXTVAL, PC$Nom, PC$Type, NULL, L$Clob, L$Blob, L$Bfile ) ; 
        -- Free the temporary objects --
        dbms_lob.freetemporary( L$Clob ) ;
        dbms_lob.freetemporary( L$Blob ) ; 
      END;
    /The table structure for this sample is the following:
    CREATE TABLE DOCUMENT (
      ID           NUMBER (5) PRIMARY KEY,
      TYP          VARCHAR2 (20),
      UTILISE      VARCHAR2 (30),
      LOB_TEXTE    CLOB,
      LOB_DATA     BLOB,
      LOB_FICHIER  BFILE,
      NOM_DOC      VARCHAR2 (100))
    /Francois

  • How to upload/download file to/from server using FiledownloadUI ?

    Hi experts,
    I don't have much experience of WDABAP. I have to upload a file  to server and then download it again. I have implemented  this functionality but I am unable to view contents of .xls/.doc/.docx/.msg file only  txt file contents are properly visible. I have used  following command to upload the file:-
    OPEN DATASET fname FOR OUTPUT IN BINARY MODE.
    I had  also tried this but it is throwing  exception that it can be used only for character type data.
    OPEN DATASET fname FOR OUTPUT IN TEXT MODE  ENCODING UTF-8    WITH SMART LINEFEED.  
    Thanks in advance.
    Problem Solved!
    Regards,
    Vishesh
    Edited by: Vishesh@1986 on Sep 26, 2011 7:37 AM

    I have resolved the issue myself!!!

  • How to upload a file into a db blob column from adf page

    How to upload a file into a db blob column from adf page
    Which option to use ?

    The forum search would be my first try...
    Then google...
    This has been asked at least once a week and got correct answers...
    Timo

  • Upload/Download file to/from a document library in a SharePoint online site

    Hi,
    I am referring to the below blog for Upload/Download file to/from a document library in a SharePoint online site.
    http://blogs.msdn.com/b/rohitpuri/archive/2007/04/10/upload-download-file-to-from-wss-document-library-using-dav.aspx?CommentPosted=true#commentmessage
    I would like to know if this is feasible with a SharePoint online site.
    If feasible, how can I resolve the below exception I am getting while using the code.
    “The remote server returned an error: (403) Forbidden”.
    Thanks,
    Thanan

    Hi,
    Actually what I am trying to achieve is the two things.
    1) By using only the user's name, need to upload/download from/to the document library of SharePoint online site using the CSOM. (i.e., achieving Single Sign On / Windows Authentication)
    2) I need to achieve the above only by passing the document URL; not by hardcording/ configuring the document library name in the windows application.
    Can anyone pls help on this now?
    [Below code is working fine. But need to arrive the solution whereas the above 2 conditions are not violated.
    using (var clientContext
    = new ClientContext("https://yoursiteurl.com"))
               string passWd
    = "password";
               SecureString securePassWd
    = new SecureString();
               foreach
    (var c in passWd.ToCharArray())
                    securePassWd.AppendChar(c);
                clientContext.Credentials
    = new SharePointOnlineCredentials("username", securePassWd);
               using
    (var fs =
    new FileStream("fileName",
    FileMode.Open))
    var fi =
    new FileInfo("fileName");
    var list = clientContext.Web.Lists.GetByTitle("Doc Library");
                   clientContext.Load(list.RootFolder);
                   clientContext.ExecuteQuery();
    var fileUrl = String.Format("{0}/{1}", list.RootFolder.ServerRelativeUrl,
    fi.Name);
    Microsoft.SharePoint.Client.File.SaveBinaryDirect(clientContext, fileUrl,
    fs, true);
    Thanks,
    Thanann

  • How to upload a file into server using j2ee jsp and servlet with bean?

    How to upload a file into server using j2ee jsp and servlet with bean? Please give me the reference or url about how to do that. If related to struts is more suitable.
    Anyone help me please!

    u don't need j2ee and struts to do file uploading. An example is as such
    in JSP. u use the <input> file tag like
    <input type="file"....>You need a bean to capture the file contents like
    class FileUploadObj {
        private FormFile srcFile;
        private byte[] fileContent;
        // all the getter and setter methods
    }Then in the servlet, you process the file for uploading
        * The following loads the uploaded binary data into a byte Array.
        FileUploadObj form = new FileUploadObj();
        byte[] byteArr = null;
        if (form.signFile != null) {
            int filesize = form.srcFile.getFileSize();
            byteArr = new byte[filesize];
            ByteArrayInputStream bytein = new ByteArrayInputStream (form.srcFile.getFileData());
            bytein.read(byteArr);
            bytein.close();
            form.setFileContent(byteArr);
        // Write file content using Writer class into the destination file in the server.
        ...

  • How to change music in uc320?how to upload mp3 file into uc320?

    Dear all,
    how to change music in uc320?only one music in uc320?
    how to upload mp3 file into uc320?
    Thanks
    John

    I am evaluating the UC320 for a phone system replacement for our 100 locations.
    Allowing us to add an MP3 file to replace the current one would be a HUGE cost savings.
    This will help us cut cost when compared to the old system.
    Currently we are spending $180 on an external mp3 player for an mp3 that’s 3MB in size.
    If this system works out we are then going to recommend it to our 1800 franchisees.

  • How to batch upload PDF files into database BLOB

    Hello.
    I have a requirement to batch upload PDF files into BLOB column of an Oracle 8.1.7 table from Forms 6i Web. The content of the blob column (ie. the PDF content) MUST be displayable from all client software (eg. Oracle Web forms, HTML forms, etc.)
    Our environment is
    Middle-tier is 9iAS on Windows/2000
    Database is Oracle 8.1.7.0.0 on VMS
    Oracle Web Forms 6i Patch 10
    Basically my Oracle web form program will display a list of PDF files to upload and then the user can click on the &lt;Upload&gt; button to do the batch upload. I have experimented the following approaches but with no luck.
    1. READ_IMAGE_FILE forms built-in = does NOT work because it cannot read PDF file. I got error FRM-47100: Cannot read image file
    2. OCX and OLE form item = cannot use this because it does NOT work on the Web. I got error FRM-41344 OLE object not defined
    3. I cannot use DBMS_LOB to do the load because the PDF files are not in the database machine.
    4. Metalink Note 1682771.1 (How to upload binary documents back to database blob column from forms). When I used this, I got ORA-6502 during the hextoraw conversion. In using this solution, I have downloaded a bin2hex.exe from the Google site. I've noticed that when I looked at the converted HEX file, each line has the character : (colon) at the beginning of each line. I know the PDF file has been converted correctly to HEX format because when I convert the HEX file back to BIN format using hex2bin.exe, I'm able to display the converted bin file in Acrobat Reader. When I removed the : (colon) in the HEX file, I did NOT get the ORA-6502 error but I CANNOT display the file in Acrobat Reader. It gives an error "corrupted file".
    5. upload facility in PL/SQL Web toolkit - I tried to automatically submit the html form (with htp.p) but it does NOT load the contents of the file. I called the URL from Oracle forms using web.show_document. There seems to be issues with Oracle Web forms (JInitiator) and HTML (+ htp.p).
    The other options I can think of at this point are:
    1. Use SQL*Loader to do the batch upload via SQL*Net connection and use HOST() built-in from Oracle Webforms to execute SQL*Loader from the 9iAS.
    2. Write a Visual Basic program that reads a binary file and output the contents of the file into a byte array. Then build a DLL that can be called from Oracle webforms 6i via ORA_FFI. I don't prefer this because it means the solution will only work for Windows.
    3. Write a JSP program that streams the PDF file and insert the contents of the PDF file into blob column via JDBC. Call JSP from forms using web.show_document. With this I have to do another connection to the database when I load the file.
    4. Maybe I can use dbms_lob by using network file system (NFS) between the application server and VMS. But this will be network resource hungry as far as I know because the network connection has to be kept open.
    Please advise. Thank you.
    Regards,
    Armando

    I have downloaded a bin2hex.exe from the Google site.
    ... each line has the character : (colon) at the
    beginning of each line. I'm afraid it isn't a correct utility. I hope you'll find the source code of a correct one at metalink forum:
    Doc ID: 368771.996
    Type: Forum
    Subject: Uploading Binary Files: bin2hex and hex2bin do not reproduce the same file
    There is some links to metalink notes and some example about working with BLOB at http://www.tigralen.spb.ru/oracle/blob/index.htm. Maybe it helps. Sorry for my English. If there is any problem with code provided there, let me know by e-mail.

  • Uploading & Downloading Files into DMS Server using Web Dynpro Java

    Hello Friends,
          I want to Upload a file from Portal to Document Management Server and to Download a file from Document Management Server to Portal,  In short, I want to give the user the facility to Upload a File into DMS Sever via Portal and also to download the file from DMS Sever via Portal.
      Can anybody give me a Input for the same from Both Java Development End as well as ABAP End, more inputs are required from ABAP end, since i have a very less ABAP Experience on working with DMS. Few Questions i have in my mind?
    1. How to actually access the file contents with the help of Document Number?
    2. With the help of Doc-Number we can extract the file from DMS sever but to provide a option for downloading in portal, the   RFC should convert the File Contents into X-String or is there some other way?
    +3. While Uploading the Data should be given in Which format to RFC? Are there any limitation with respect to size or formats. Is there any Standard RFC i can use directly in WD4 Java application to upload the file into DMS Server and which will return me the Document Number? +
    Please give me your valuable inputs.
    Thank You.
    Edited by: TusharShinde on Feb 21, 2011 11:13 AM
    Now, I am able to download the File in Portal via my WD4 Java Application from DMS Server by passing the Document Number, but I am facing the problem in downloading the PDF files, Its not working for PDF files. Please give me inputs for the same.
    Thank You.
    Edited by: TusharShinde on Feb 22, 2011 10:13 AM

    HI,
    Thanks for reply.
    I am able to download the file From DMS server but I am still not able to Upload the File to DMS Server via Portal. For Download also it is working for all file formats but not for PDF any specific reason for the same.
    function zhrf_rfc_dms_download_document.
    *"*"Local Interface:
    *"  IMPORTING
    *"     VALUE(LV_DOCUMENT) TYPE  DOKNR
    *"  EXPORTING
    *"     VALUE(LV_FADA) TYPE  XSTRING
    *"  TABLES
    *"      LT_DOC STRUCTURE  BAPI_DOC_FILES2
    *"      LT_OUT STRUCTURE  ZST_DMS_FILE_XSTRING
    data: ls_docfiles type bapi_doc_files2,
             ls_dms type dms_doc_files,
             lt_docfiles type standard table of bapi_doc_files2.
    *      data: LT_OUT  type table of  ZST_DMS_FILE_XSTRING.
      data :wa_out like line of lt_out.
      select single * from dms_doc_files
        into ls_dms
        where doknr = lv_document."Retrieve file
      if sy-subrc = 0.
        ls_docfiles-documenttype = ls_dms-dokar.
        ls_docfiles-documentnumber = lv_document.
        ls_docfiles-documentpart = ls_dms-doktl.
        ls_docfiles-documentversion = ls_dms-dokvr.
    *    ls_docfiles-documenttype = '321'.
    *    ls_docfiles-documentnumber = LV_DOCUMENT.
    *    ls_docfiles-documentpart = '000'.
    *    ls_docfiles-documentversion = 'A0'.
      endif.
      call function 'BAPI_DOCUMENT_CHECKOUTVIEW2'
        exporting
          documenttype    = ls_docfiles-documenttype
          documentnumber  = ls_docfiles-documentnumber
          documentpart    = ls_docfiles-documentpart
          documentversion = ls_docfiles-documentversion
          documentfile    = ls_docfiles
          getstructure    = '1'
          getcomponents   = 'X'
          getheader       = 'X'
    *      pf_http_dest    = 'SAPHTTPA'
          pf_ftp_dest     = 'SAPFTPA'
        tables
          documentfiles   = lt_docfiles.
      data: i_bin type standard table of sdokcntbin,
            i_info type standard table of scms_acinf,
            v_info type scms_acinf,
            v_id type sdok_phid,
            v_cat type sdok_stcat.
      if sy-subrc = 0.
        loop at lt_docfiles into ls_docfiles.
          v_id = ls_docfiles-docfile.
          v_cat = ls_docfiles-storagecategory.
          call function 'SCMS_DOC_READ'
            exporting
              stor_cat              = v_cat
              doc_id                = v_id
              phio_id               = ls_docfiles-file_id
            tables
              access_info           = i_info
              content_bin           = i_bin
            exceptions
              bad_storage_type      = 1
              bad_request           = 2
              unauthorized          = 3
              comp_not_found        = 4
              not_found             = 5
              forbidden             = 6
              conflict              = 7
              internal_server_error = 8
              error_http            = 9
              error_signature       = 10
              error_config          = 11
              error_format          = 12
              error_parameter       = 13
              error                 = 14
              others                = 15.
        endloop.
        if sy-subrc <> 0.
        else.
          data: v_xstring type xstring.
          read table i_info into v_info index 1.
          call function 'SCMS_BINARY_TO_XSTRING'
            exporting
              input_length = v_info-comp_size
            importing
              buffer       = v_xstring
            tables
              binary_tab   = i_bin
            exceptions
              failed       = 1
              others       = 2.
          if sy-subrc <> 0.
          endif.
        endif.
        wa_out-file_name =  ls_docfiles-docfile.
        wa_out-binary = v_xstring.
        lv_fada = v_xstring.
        append wa_out to lt_out.
      endif.
    endfunction.
    The above is the RFC Code,  I am using in my WD4Java app for downloading the file From DMS Server, Is there any Improvement suggested for above RFC to make it work in more efficient way. Please give me input for my Upload RFC.
    Thank You.

  • How to upload a file into file system on server?

    We want to allow our partners to upload .csv file on our unix box. How do we upload a file into file system. I might be wrong but after reading the documentation, I think OA framework only allows to save the file in database. Please advise.
    Thanks,

    Hi,
    I was making a very silly mistake and found it. We need to create a new Entity object before you try to fill it with data. So what we can do is in the Controler, call a method in the AM that creates a new entity object (this should be made in processRequest, so that the VO gets initialized when the page loads).
    Now you can fill the entity with data in the page (ie browse and choose the file), and then when the page is submitted call a method AM again but now in processFormRequest to do the commit.
    code example
    In the AM class
    * Creates a new createCVRecord. To be Called from ProcessRequest when the page loads.
    public void createCVRecord()
    XxPersonCVVOImpl vo = getXxPersonCVVO1();
    if (!vo.isPreparedForExecution())
    vo.executeQuery();
    Row row = vo.createRow();
    vo.insertRow(row);
    // Required per OA Framework Model Coding Standard M69
    row.setNewRowState(Row.STATUS_INITIALIZED);
    } // end createCVRecord()
    * The commit method. To be Called from ProcessFormRequest when the page is submitted.
    public void apply()
    getTransaction().commit();
    or else there is a different way... please refer the following thread for more details....
    File Upload
    thanks to martin, who pointed out the mistake.

  • How to upload & Download file in Adf using Jdeveloper 11.1.2 ??

    Hi All,
    I have just started working on Oracle ADF, Thanks a lot guys for solving our queries.
    I'm using Jdeveloper 11.1.2, How to upload and download file in ADF..?
    I have seen couple links on net but none of them worked on jdeveloper 11.1.2......
    Please Help......

    Hi guys,
    I'm able to download file in ADF using af:fileDownloadActionListener.......
    does any one knows how to upload a file using ADF???

  • How to upload a file into specified location

    Hi Frndz..
    How to upload a file using File upload feature in web dynpro into our specified location(usr/sap/Images/....),not into  workspace r default path in server.
    Thanks in Advance
    Regards
    Rajesh

    Hi Rajesh,
    Use below code on your "Upload" Action:
         try
    // Give full path of folder on server where you want to upload the file.
              File file = new File("D:\\usr\\sap\\Images\\"+wdContext.currentContextElement().getResource().getResourceName().toString());
    // D:\usr\sap\Images folder should present on server
              FileOutputStream op = new FileOutputStream(file);
              if(wdContext.currentContextElement().getResource()!=null)
                   text=wdContext.currentContextElement().getResource().read(false);
                        while((temp=text.read())!=-1)
                             op.write(temp);
              op.flush();
              op.close();
         catch(Exception e)
              wdComponentAPI.getMessageManager().reportSuccess("Error while uploading file : "+e.getMessage());
    Thanks
    Sandy

  • How To Upload/Download Files in WDP from KM

    Hi folks,
    I'm developing an Web Dynpro application for Portal and using a upload and download component.
    I'd like to use the KM as a file repository. How can I send and get those files to/from KM application in Portal?
    Using: SAP Studio 2.0.9 SP9 (WDP), SAP WebAS 6.40.
    By the way, is it possible to send those files to mobile/pda using MI Client?
    Regards,
    Rogerio

    Hi Rogerio,
    see https://www.sdn.sap.com/irj/servlet/prt/portal/prtroot/com.sap.km.cm.docs/library/webas/tutorial on using knowledge management functions in web dynpro.htm
    Hope it helps
    Detlev
    PS: Please consider rewarding points if answers are helpful on SDN. Thanks in advance!

  • How to upload music files into iTunes, iCloud

    How do I upload music & other files (like photos) into iTunes, iCloud & iphone 4S?  I restored my phone yesterday & had to upgrade to iTunes 11.0.2 from 10, as prompted by the system.  Pls help as I am a novice in iphones & family

    You cannot upload music files from your iPhone, but you could sign up for iTunes Match and use it to match your existing music with iTunes so that you can download it right from your device. See more information for Apple's iTunes Match: https://www.apple.com/itunes/itunes-match/

  • How to upload multiple files into a server location at a single time

    Hi All,
    In my application i need to send multiple files from a particular page into the server location. In this page there will be an option to upload a file and after selecting the file , we will have an option asking if we were interested to send another file. It works just similar to google mail where we can multiple files at the same time. Right now though i had coded the uploading files concept i am facing some problems when trying to upload multiple files. All the files are being appended to a single file but i want them to be placed as different files at the specified location. Plz help me in this regard...
    Thanks in advance................,,

    Hi,
    i am sending the code in my prg. Have a look at it.
    var multi_selector = new MultiSelector( document.getElementById( 'files_list' ),3);
    In the above line i am specyfying that the maximum no. of files to be uploaded is 3. So if i upload less than 3 files, the program doesn't work and is not reading the uploaded files. If i upload 3 files it works fine. So please suggest me how to make this work irrespective of the no. of files uploaded using apache commons.
    My code is as follows:
    <form action="./servlet/Sample" method = "post" enctype="multipart/form-data">
         <!-- The file element -- NOTE: it has an ID -->
         <input id="my_file_element" type="file" name="file_1" >
         <input type="submit" name="submit1" value="submit">
    </form>
    Files:
    <!-- This is where the output will appear -->
    <div id="files_list"></div>
    <script>
         <!-- Create an instance of the multiSelector class, pass it the output target and the max number of files -->
         var multi_selector = new MultiSelector( document.getElementById( 'files_list' ),3);
         <!-- Pass in the file element -->
         multi_selector.addElement( document.getElementById( 'my_file_element' ) );
    </script>

Maybe you are looking for