Upload binary file with DSEEntry

Hi ,
I have created a Class for a upload pictures to the IDM Database .
Now I have the problem with the upload.... and the mssql datatype.
At the moment the type is binary(max)
is there any option to add a byte[] to DSEntry.put ?
It seems that DSEntry always try a cast to string , and when put a byte[] I receive an exception.
Regards

Usually binary values are B64 or HEX encoded during processing in IdM. I take it you're trying to write it to a column of datatype binary, not an actual IdM attribute. Perhaps you should use varbinary(max) if you want to exceed 8000 bytes. But, the internal datatypes and the JDBC datatypes are not the same, so for SQL Server you need to use LONGVARBINARY.
see this MicroSoft reference: Using Advanced Data Types
Anyway, here's a working example. The $includebin function is documented in the helpfile but its usage is pretty self explaining in my example here:
My table looks like this:

Similar Messages

  • Upload binary files with Developer Forms

    Hi all,
    I'm newbie with Forms and I don't know if this question is already answered.
    I'm deploying an application involved with blob columns (binary files: pdf, doc, gif, etc) I want to let users to choose files from his PCs (typical "Browse files" button) but I don´t know if this is possible and if yes, how to implement it.
    Anybody can help me?
    My email is [email protected]
    Thanks in advance!
    Cristina

    If you want to upload direct into the database from the client then No you will need a 9i database or above.
    If you want to upload a file from the browser client to the middle tier (Application server) then that will be OK no matter what DB version you are using. Bug of course you'll then need to do the last bit yourself if you want the document / image put into the database.

  • How to upload binary file in database?

    Using servlets..how to upload binary file into database...
    How to get the data of file in servlet...
    Please reply...i'm unable to find exact code...that i want..

    You need to do two separate parts: accept the file from a HTTP multi-part POST and then stream it into a BLOB on the database. To do the former, download Jakarta Commons FileUpload. There is extensive documentation on how to write a simple handler for the upload. You then need to send the data to a BLOB. The specifics vary from database to database but generally you will insert or update a row with an empty blob, get a reference to the blob, pipe the data and then commit.
    If you do a quick forum search, this question has been asked (and answered) dozens of times. Some of the replies may even have code for you. Best of luck.
    - Saish

  • Upload multiple files WITH correct pairs of form fields into Database

    In my form page, I would like to allow 3 files upload and 3 corresponding text fields, so that the filename and text description can be saved in database table in correct pair. Like this:
    INSERT INTO table1 (filename,desc) VALUES('photo1.jpg','happy day');
    INSERT INTO table1 (filename,desc) VALUES('photo2.jpg','fire camp');
    INSERT INTO table1 (filename,desc) VALUES('photo3.jpg','christmas night');
    However, using the commons fileupload, http://commons.apache.org/fileupload/, I don't know how to reconstruct my codes so that I can acheieve this result.
    if(item.isFormField()){
    }else{
    }I seems to be restricted from this structure.
    The jsp form page
    <input type="text" name="description1" value="" />
    <input type="file" name="sourcefile" value="" />
    <input type="text" name="description2" value="" />
    <input type="file" name="sourcefile" value="" />The Servlet file
    package Upload;
    import sql.*;
    import user.*;
    import javax.servlet.*;
    import javax.servlet.http.*;
    import java.util.Map;
    import java.util.HashMap;
    import java.util.Date;
    import java.util.List;
    import java.util.Iterator;
    import java.io.File;
    import java.io.PrintWriter;
    import java.io.IOException;
    import java.text.SimpleDateFormat;
    import org.apache.commons.fileupload.servlet.ServletFileUpload;
    import org.apache.commons.fileupload.disk.DiskFileItemFactory;
    import org.apache.commons.fileupload.*;
    public class UploadFile extends HttpServlet {
    private String fs;
    private String category = null;
    private String realpath = null;
    public String imagepath = null;
    public PrintWriter out;
    private Map<String, String> formfield = new HashMap<String, String>();
      //Initialize global variables
      public void init(ServletConfig config, ServletContext context) throws ServletException {
        super.init(config);
      //Process the HTTP Post request
      public void doPost(HttpServletRequest request,HttpServletResponse response) throws ServletException, IOException {
        request.setCharacterEncoding("utf-8");
        response.setCharacterEncoding("utf-8");
        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        Thumbnail thumb = new Thumbnail();
        fs = System.getProperty("file.separator");
        this.SetImagePath();
         boolean isMultipart = ServletFileUpload.isMultipartContent(request);
         if(!isMultipart){
          out.print("not multiple part.");
         }else{
             FileItemFactory factory = new DiskFileItemFactory();
             ServletFileUpload upload = new ServletFileUpload(factory);
             List items = null;
             try{
                items = upload.parseRequest(request);
             } catch (FileUploadException e) {
                e.printStackTrace();
             Iterator itr = items.iterator();
             while (itr.hasNext()) {
               FileItem item = (FileItem) itr.next();
               if(item.isFormField()){
                  String formvalue = new String(item.getString().getBytes("ISO-8859-1"), "utf-8");
                  formfield.put(item.getFieldName(),formvalue);
                  out.println("Normal Form Field, ParaName:" + item.getFieldName() + ", ParaValue: " + formvalue + "<br/>");
               }else{
                 String itemName = item.getName();
                 String filename = GetTodayDate() + "-" + itemName;
                 try{
                   new File(this.imagepath + formfield.get("category")).mkdirs();
                   new File(this.imagepath + formfield.get("category")+fs+"thumbnails").mkdirs();
                   //Save the file to the destination path
                   File savedFile = new File(this.imagepath + formfield.get("category") + fs + filename);
                   item.write(savedFile);
                   thumb.Process(this.imagepath + formfield.get("category") +fs+ filename,this.imagepath + formfield.get("category") +fs+ "thumbnails" +fs+ filename, 25, 100);
                   DBConnection db = new DBConnection();
                   String sql = "SELECT id from category where name = '"+formfield.get("category")+"'";
                   db.SelectQuery(sql);
                    while(db.rs.next()){
                      int cat_id = db.rs.getInt("id");
                      sql = "INSERT INTO file (cat_id,filename,description) VALUES ("+cat_id+",'"+filename+"','"+formfield.get("description")+"')";
                      out.println(sql);
                      db.RunQuery(sql);
                 } catch (Exception e){
                    e.printStackTrace();
            HttpSession session = request.getSession();
            UserData k = (UserData)session.getAttribute("userdata");
            k.setMessage("File Upload successfully");
            response.sendRedirect("./Upload.jsp");
      //Get today date, it is a test, actually the current date can be retrieved from SQL
      public String GetTodayDate(){
        SimpleDateFormat format = new SimpleDateFormat("yyyyMMdd");
        String today = format.format(new Date());
        return today;
      //Set the current RealPath which the file calls for this file
      public void SetRealPath(){
        this.realpath = getServletConfig().getServletContext().getRealPath("/");
      public void SetImagePath(){
        this.SetRealPath();
        this.imagepath = this.realpath + "images" +fs;
    }Can anyone give me some code suggestion? Thx.

    When one hits the submit button - I then get a 404 page error.What is the apaches(?) error log saying? Mostly you get very useful information when looking into the error log!
    In any case you may look at how you are Uploading Multiple Files with mod_plsql.

  • How to upload a file with a HTML form into a BLOB ?

    Hi,
    I want to upload a file into a BLOB.
    I have created a procedure in PL/SQL whitch generates an html form.
    You can upload a file with <input type="file" name="my_file">.
    How can I insert this file into my database ?
    Thank's for your Help
    Estelle

    Hi Estelle,
    Portal Applications forum is a more apporpriate forum for such questions. Please post your question there.
    Thanks,
    Ravi

  • I have written a binary file with a specific header format in LABVIEW 8.6 and tried to Read the same Data File, Using LABVIEW 7.1.Here i Found some difficulty.Is there any way to Read the Data File(of LABVIEW 8.6), Using LABVIEW 7.1?

    I have written a binary file with a specific header format in LABVIEW 8.6 and tried  to Read the same Data File, Using LABVIEW 7.1.Here i Found some difficulty.Is there any way to Read the Data File(of LABVIEW 8.6), Using LABVIEW 7.1?

    I can think of two possible stumbling blocks:
    What are your 8.6 options for "byte order" and "prepend array or string size"?
    Overall, many file IO functions have changed with LabVIEW 8.0, so there might not be an exact 1:1 code conversion. You might need to make some modifications. For example, in 7.1, you should use "write file", the "binary file VIs" are special purpose (I16 or SGL). What is your data type?
    LabVIEW Champion . Do more with less code and in less time .

  • Upload a file with an Applet

    Hi,
    I want to know if it's possible to upload a file with an Applet, but not a signed Applet.
    Thanks
    Cris

    Yes, but you are limited to uploading to the server from where the applet was originating from.
    Regards,
    Peter Norell

  • How to upload a binary file with Firefox 7

    Don't know if this is the right forum to ask this - if not, please point me in the right direction.
    I am an embedded developer using Firefox as the user interface to an embedded web server. In the past I've been using file.getAsBinary() to read the local file which is then uploaded with an XMLHttpRequest. Firefox 7 removed the getAsBinary method. Looking through the documentation I came across FileReader and have been trying to use that but with no luck. When I use the readAsBinaryString method, the binary has many bytes which are in error. I have also tried the readAsDataURL but this gives me base64 encoding. Attempts to decode it so far have been unsuccessful. What's the best way to get a local file and upload it to a remote server?
    Thanks,
    Dave

    Well, actually, i have no perfect solution.
    I just used a temporary internal table in which all fields are characters. Then, I used FM GUI_UPLOAD to upload text file including header into this table as usual.
    You can see that it was done successfully. Next, use a loop to transfer this temporary table to the main table. SAP will automatically convert data into values that are compatible with data type in the main table, so don't worry about different types :D.
    In order to make this work more simple, field names of temporary table should be named exactly as same as those in the main one. So, u just use:
    loop at itab_tmp.
      move-corresponding itab_tmp to itab_main.
      append itab_main.
      clear itab_main.
    endloop.
    note: both tables have their own header line, so don't need use a working area here.
    Anyone has any better solution?

  • Unable to upload a file with Drag and Drop and http

    Hello,
    I am trying to upload a file through the web interface (Netscape 4.7 and IE 5.0). When I click un upload, Via Drag and Drop, a new window is started, but never completes.
    With Netscape, I get a message box: Netscape is unable to locate the server null. Please check the server name and try again.
    With IE 5, I get an error: This page can not be displayed.
    Are there any files I need to edit on the PC side to get this to work?
    Thanks
    Scott
    PS I think you guys are doing a great job with support on iFS.

    WebUI Drag & Drop requires FTP to be running and available.
    Drag & Drop is really just uses the browser built in FTP ability.

  • Issue in reading a binary file, with 'Flatten to String' data.

    I'm facing issue while reading a binary file (created using LabVIEW).
    I've mentioned everything (issue and method to reproduce it) within the attached VI.
    Same vi is attached in 2012 and 8.0 versions.
    Regards
    I am not allergic to Kudos, in fact I love Kudos.
     Make your LabVIEW experience more CONVENIENT.
    Solved!
    Go to Solution.
    Attachments:
    Issue in VI.vi ‏26 KB
    Issue in VI (Version 8.0).vi ‏43 KB

    moderator1983 wrote:
    crossrulz wrote:
    The reading of a string from a binary file stops at a NULL character (0x00).  When the first character is 0x00, you are just reading the one character.  I would suggest writing to a byte array since you are doing the inverting.  And then you can read as a byte array.
    crossrulz:
    U rocks..!!
    you have hit bull's eye...!!
    After playing around a little more, I think I might have misinformed you a little.  If you explicitly tell it a string, it looks for the string length at the very beginning and reads that length of bytes as a string.  It appears that if you implicitly tell it to read a string (not wire the data type) it reads all of the bytes directly, including the length of string you wrote.
    Regardless, my advice is the same.  You should just write and read using byte array.  It is less conversions if you are performing your "encryption".
    EDIT:  Here's a snippet of the VI I was playing with to figure this out.
    There are only two ways to tell somebody thanks: Kudos and Marked Solutions
    Unofficial Forum Rules and Guidelines
    Attachments:
    String Binary File.png ‏12 KB

  • Gui_upload for uploading binary file

    Hello All,
    I am trying to upload '.jpg' files using gui_upload function.
    But something goes wrong and it dumps.
    I am new to ABAP.
    following is the code i used.
      DATA: xline TYPE xstring.
      DATA : t_file LIKE TABLE OF xline WITH HEADER LINE.
      CALL FUNCTION 'GUI_UPLOAD'
        EXPORTING
          filetype = 'BIN'
          filename = 'C:\Documents and Settings\I046674\Desktop\RawTest\images\Image_1000.jpg'
        TABLES
          data_tab = t_file.
    It dumps in the 'GUI_UPLOAD' function itself.
    Saying follownig,
    ==========================================
    Error analysis
        The error occurred at a statement in the form
          ASSIGN f TO <fs> TYPE t
        One of these two cases occurred:
        1) Field f is a string, a data reference, an object reference, an
           internal table or a structure that contains such a field. With the
           TYPE addition, this is not possible.
        2) Field f is of type x and field symbol <fs> has a character-type type.
           When executing the statement, the length of f is not a multiple of
           the length (in bytes) of a Unicode character.
    ===============================================
    Can someone help me on this?
    Thanks & Regards,
    Abhijit

    hi,
    Master Data Documents Upload ABAP Program
    Re: Upload Master Data documents
    CALL FUNCTION 'GUI_DOWNLOAD'
    EXPORTING
    filename = 'c:\temp\text.txt'
    filetype = ' '
    IMPORTING
    filelength = fleng
    TABLES
    data_tab = text_tab
    EXCEPTIONS
    file_write_error = 1
    invalid_type = 2
    no_authority = 3
    unknown_error = 4
    OTHERS = 10.
    thanks

  • Error message while upload excel file (with macro) to sap (iw28)

    While upload excel file to sap through iw28, i get error message (vb)
    u2022     i have to say that the excel file contain macro , with out the macro , work fine .
    u2022     The error display just in refresh command.
    the error message :
    Public Sub ALV_CUS_Exit()
    Dim objs As ChartObjects
    Dim obj As ChartObject
    Dim sheet As Worksheet
    Dim r As Range
    For Each sheet In Sheets
    Set objs = sheet.ChartObjects
    For Each obj In objs
    Set r = Sheets("RawData").UsedRange
    obj.Chart.SetSourceData Source:=r
    Next obj
    Next sheet
    End Sub

    hi,
    This is releated to the ABAP coding...There might be some ouput problem in the Abap list viewer...Pls check it with the ABAP consultant...
    Regards
    Priyanka.P

  • Upload text files with non-english characters

    I use an Apex page to upload text files. Then i retrieve the contents of files from wwv_flow_files.blob_content and convert them to varchar2 with utl_raw.cast_to_varchar2, but characters like ò, à, ù become garbage.
    What could be the problem? Are characters lost when files are stored in wwv_flow_files or when i do the conversion?
    Some other info:
    * I see wwv_flow_files.DAD_CHARSET is set to "ascii", wwv_flow_files.FILE_CHARSET is null.
    * Trying utl_raw.cast_to_varchar2( utl_raw.cast_to_raw('àòèù') ) returns 'àòèù' correctly;
    * NLS_CHARACTERSET parameter is AL32UTF8 (not just english ASCII)

    Hi
    Have a look at csv upload -- suggestion needed with non-English character in csv file it might help you.
    Thanks,
    Manish

  • Upload Csv files with infopackages - Error 1

    Hello again,
    i'm trying to upload csv file into a infopackage with master data text but the sistem sends a error message "Error 1 uploading external data".
    Infopackage settings:
    source system: PC
    file type: data file
    csv file
    data separator ;
    ESC signal "
    a created a txt file with data separated with ; and later converted txt file into a csv file.
    can anybody help me pls?
    Thanks
    Silvia Marques

    Hi Silvia,
    If the fields are correct in the transfer structure (only 2 fields). Then check whether the field length and type has been defined correctly for both the fields.
    If thats not a problem then try to load only upto PSA.
    If you are using IDOC as your transfer method then go to the "details" tab of the monitor of the error request and see the details. It will give you the correct picture of the error.
    Bye
    Dinesh.

  • Can't decrypt binary file with PBE

    Hi,
    I'm writing an simple file transfer application using UDP that encrypts the data
    before sending it with PBEWithMD5AndDES. Text files are encrypted and
    decrypted fine, but binary files such as a JPG/EXE/DOC... are messed up
    and an application can't open them on the other side. Has anyone experienced
    such a problem?
    Thanks

    Below are my encrypt and decrypt functions.
    Thanks in advance.
            public  byte[] encrypt(byte[] data)
                 PBEKeySpec pbeKeySpec;
                 PBEParameterSpec pbeParamSpec;
                 SecretKeyFactory keyFac;
                 ByteArrayOutputStream b=null;
                 DataOutputStream d =null;
                 //      Salt
                 byte[] salt = {
                           (byte)0xc7, (byte)0x73, (byte)0x21, (byte)0x8c,
                        (byte)0x7e, (byte)0xc8, (byte)0xee, (byte)0x99
                 //      Iteration count
                 int count = 1000;
                 // Create PBE parameter set
                 pbeParamSpec = new PBEParameterSpec(salt, count);
                 try{
                      pbeKeySpec = new PBEKeySpec(sessionPassword.toCharArray());
                      keyFac = SecretKeyFactory.getInstance("PBEWithMD5AndDES","SunJCE");
                      SecretKey pbeKey = keyFac.generateSecret(pbeKeySpec);
                      // Create PBE Cipher
                      Cipher pbeCipher = Cipher.getInstance("PBEWithMD5AndDES","SunJCE");
                      // Initialize PBE Cipher with key and parameters
                      pbeCipher.init(Cipher.ENCRYPT_MODE, pbeKey, pbeParamSpec);
                      b = new ByteArrayOutputStream();
                      d = new DataOutputStream(b);
                      // create CipherOutputStream
                      CipherOutputStream out = new CipherOutputStream( b, pbeCipher );
                      // write contents to file and close
                      try {
                           for ( int i = 0; i < data.length; i++ )
                                out.write(data);
                             out.flush();
                        out.close();
                   // handle IOException
                   catch ( IOException exception ) {
                        exception.printStackTrace();
              catch(Exception e){}
              return(b.toByteArray());
         public byte[] decrypt(byte[] data)
              PBEKeySpec pbeKeySpec;
              PBEParameterSpec pbeParamSpec;
              SecretKeyFactory keyFac;
              byte[] decryptedData=null;
              //      Salt
              byte[] salt = {
                        (byte)0xc7, (byte)0x73, (byte)0x21, (byte)0x8c,
                        (byte)0x7e, (byte)0xc8, (byte)0xee, (byte)0x99
              //      Iteration count
              int count = 1000;
              // Create PBE parameter set
              pbeParamSpec = new PBEParameterSpec(salt, count);
              try{
                   pbeKeySpec = new PBEKeySpec(sessionPassword.toCharArray());
                   keyFac = SecretKeyFactory.getInstance("PBEWithMD5AndDES","SunJCE");
                   SecretKey pbeKey = keyFac.generateSecret(pbeKeySpec);
                   // Create PBE Cipher
                   Cipher pbeCipher = Cipher.getInstance("PBEWithMD5AndDES","SunJCE");
                   // Initialize PBE Cipher with key and parameters
                   pbeCipher.init(Cipher.DECRYPT_MODE, pbeKey, pbeParamSpec);
                   Vector fileBytes = new Vector();
                   ByteArrayInputStream b = new ByteArrayInputStream(data);
                   CipherInputStream in = new CipherInputStream( b, pbeCipher );
                   byte contents = ( byte ) in.read();
                   while ( contents != -1 )
                        fileBytes.add( new Byte( contents ) );
                        contents = ( byte ) in.read();
                   in.close();
                   decryptedData = new byte[ fileBytes.size() ];
                   for ( int i = 0; i < fileBytes.size(); i++ )
                        decryptedData[ i ] = (( Byte )fileBytes.elementAt( i )).byteValue();
              catch(Exception e){Gui.chatArea.append("exception:"+e+"\n");}
              return(decryptedData);

Maybe you are looking for

  • Performance Issue in a ABAP Report

    Hi All, I am facing a big performance issue in a abap program which produce the cash flow details our group of company. This is the logic I used to develop the report. (It is a SAP Script) - First I am getting the closed customer payment records from

  • ESS LEAVEREQUEST APPLICATION NEED TO ATTACH MEDICAL CERTIFICATE

    HI, We are implementing the ESS leave request application.Here Employee sending Medical leaves for more than 2 days will require  Provision of attachment of medical certificate. how can i resolve this Issue and which process i need to follow Please a

  • BADI/User Exit to capture DELETED DATE - MIRO/MIR7

    Hi Friends, Could anybody help me out in finding a BADI or User Exit (or some other means) so as to get the actual deleted date for the documents parked through MIRO/MIR7 ? (I have found a BTE to capture the deleted date for the documents parked thro

  • Shape outlines change size when skewed. Is this normal?

    Good Morning InDeisgn Experts and Gurus, I created a shape in InDesign CS5, and applied and outline to it of 4px.  However, when I skewed the shape, the size of the outline changed on the sides. Is this normal? How would I remedy this, besides creati

  • Why am I getting an app store error when trying to download Lion?

    Why am I getting an app store error when trying to download Lion? Any ideas?