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.

Similar Messages

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

  • 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

  • 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

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

  • I have made .indd file with some form fields in it, now haw to read these fields and manipulate its content through script in indesign

    I have made .indd file with some form fields in it, now haw to read these fields and manipulate its content through script in indesign

    It's probably best to ask in the InDesign Scripting forum:
    InDesign Scripting

  • Display blob file with oracle forms

    I need to display an image file with oracle forms.
    can any body tell me how to do this ?
    Thanks

    How to do this is dependent on which version of Oracle Forms you are using. Please let us know what version (eg; 10.1.3.x.x not 10g) of Oracle Forms you are using and how your application is deployed (Client/Server or web). If web, what is your Java version?
    Craig...

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

  • 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

  • Binary file with File adapter

    Hi gurus,
    I am getting binary file as base64binary (not a text/xml file) in a request XML tag. I need to write this file to a file directory with the file adapter after retrieving it from the request message by a message/java mapping and use another field in XML as the file name.
    I followed the blog `how to send binary data through PI` but in that case, the request message is also the same. Mine requires a mapping to be executed and in this case I cannot use dummy names for message types/interfaces as Enterprise Repository development is required.
    How can I achieve this?
    Thanks
    Gokhan

    Just solved the problem actually
    As I was trying to write a binary file directly with the receiver file adapter, I wasn't sure how to define a data type / message type for it. I developed a java mapping that decodes the base64 to binary data and writes it to the output stream, and used a dummy message type / data type for the service interface as the target in Operation Mapping
    And it worked!
    Regards,
    Gökhan

  • Uploading a File with AppleScript via JavaScript

    Hi everybody,
    being new to AppleScripting and JavaScripting I'm faced with the following problem:
    Is it possible to make AppleScript to input the path for a file to be uploaded via JavaScript? If yes, what should be the correct Path Format and how to wrap it up the JavaScript action into AppleScript? I've tried a few comands but to no success.
    On the webpage in question, there's a "Choose" button, that is defined as follows:
    <input type=​"file" class=​"gwt-FileUpload" name=​"swfFile">​
    I've been trying to use the following syntax:
    do JavaScript "document.getElementsByName('swfFile')[0].value('Macintosh HD:Users:myaccount:Desktop:Scrapbook:!动画.swf')" in document 1
    as well as this one, where the Path is definitelly understood by shellscript:
    do JavaScript "document.getElementsByName('swfFile')[0].value('/Users/myaccount/Desktop/Scrap book/!动画.swf')" in document 1
    The name of the file is (and must remain) in chinese, but for testing purposes I have also tried files with english names, without success.
    Currently I'm using a solution with JavaScript comand:
    do JavaScript "document.getElementsByName('swfFile')[0].click()" in document 1
    to click the finder  window to browse for the file, and manipulating  keystrokes by using System Events to find the right file, but it's not  infallible with a number of files and it's hardly an ellegant sollution.
    Any idea what I'm doing wrong?
    Cheers!

    @twtwtw
    the do JavaScript "document.forms[0].submit()" command didn't work, so I kept the original way of submitting by clicking the button. The submitting part works, but not the input file part.
    That's the code I used
        tell application "Safari"
            do JavaScript "document.getElementById('gwt-uid-13').value='on'" in document 1
            do JavaScript "document.forms[0].elements['swfFile'].value=" & "'" & SWFFilePath & "'" in document 1
            do JavaScript "document.getElementsByClassName('gwt-SubmitButton')[0].click()" in document 1  
            delay 1
        end tell
    with SWFFilePath set as the POSIX path as well as the default file format
    Macintosh HD:Users:myaccount:Desktop:Scrapbook:!动画.swf'
    but it did not work.
    If you've got the time, feel free to upload an .swf. The service is free and the server delats uploaded files after 15 min. (if you don't have any, you may try an empty .txt file instead - it won't get converted, but the point is just to get it into the input box).
    In the meantime, I'll have a look at adayzdone's suggestion. It's not perfect (the downside being that it requires the window to be active, so I can't run the script in the background or with my screensaver & password on), but it's still more reliable than my sollution with navigating arrowkeyes.

  • How to delete one existing file before uploading a file with same name?

    Hello everybody.
    I am uploading a file to Tomcat server. But, the problem is:
    i want to delete an existing file in the server, if i upload a fresh file with same name. In other words, "First check for the file with the same name in the server. If it exists, then delete existing file in the server and upload fresh one". If such file doesnot exist, then upload the file to server.
    I have given deleteonExit()
    but, for the first time when user is uploading, i want to check for the file with same name in the server.
    i am pasting the code here. please help:
    <!-- uploading the file -->
    <%
    String contentType = request.getContentType();
    if ((contentType != null) && (contentType.indexOf("multipart/form-data") >= 0))
    DataInputStream in = new DataInputStream(request.getInputStream());
    int formDataLength = request.getContentLength();
    byte dataBytes[] = new byte[formDataLength];
    int byteRead = 0;
    int totalBytesRead = 0;
    while (totalBytesRead < formDataLength)
    byteRead = in.read(dataBytes, totalBytesRead, formDataLength);
    totalBytesRead += byteRead;
    String contextRootPath = this.getServletContext().getRealPath("/");
    contextRootPath=contextRootPath.concat("uploaded");
    String file = new String(dataBytes);
    String saveFile = file.substring(file.indexOf("filename=\"") + 10);
    saveFile = saveFile.substring(0, saveFile.indexOf("\n"));
    saveFile = saveFile.substring(saveFile.lastIndexOf("\\") + 1,saveFile.indexOf("\""));
    // Create a directory; all ancestor directories must exist
    File outputFile = new File(contextRootPath, saveFile);
    var=outputFile.getPath();
    outputFile.createNewFile();
    int lastIndex = contentType.lastIndexOf("=");
    String boundary = contentType.substring(lastIndex + 1,contentType.length());
    int pos;
    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;
    FileOutputStream fileOut = new FileOutputStream(outputFile);
    fileOut.write(dataBytes, startPos, (endPos - startPos));
    fileOut.flush();
    fileOut.close();
    outputFile.deleteOnExit();
    %>Please help. Thanks for taking time.
    Regards,
    Ashvini

    Thank you MartinHilpert,
    I have one more doubt,
    I am uploading the file to one folder called "uploaded". Before uploading a fresh file, i want to delete all existing files in that folder. IS that possible ?? If yes, can you please tell me how to do that ??
    Regards, Thanks for your time.
    Ashlvini

  • Getting Java Beans working with Developer Forms 6i

    Hello everyone,
    I have been trying to get Java Beans to work with the Developer Forms 6i. I keep getting diffrent errors depending on the bean I play with. I will detail the problems and the computer setup. I am sure this problem is a configuration one, I just dont seem to have enough experiance to determine the issue or the configuration problem.
    Here are the problems I am encountering:
    Problems 1:
    --JDeveloper 10g
    I cant see the VBean class. When I add this code, the VBean decleration comes up with an error.
    import oracle.forms.ui.VBean;
    public class MyNewClass extends VBean
    public Class1()
    This code shows the IMPORT statement with a wavy blue line under it and the word VBean after the extends also has on. I understand that this means that the JDeveloper cant find the class, I just cant seem to find the correct environment variable to set to point to this.
    Second Problem:
    --Forms 6i
    I open forms, and create a new form. I then add a datablock and a canvas. I open the canvas and drop the BeanArea component on the canvas. I enter the fully pathed/qualified Bean in the Implementation Class and get one of three errors. Either a FRM-13008, a FRM-99999 with a 13009 or a 13010 error. I suspect that the 13008 error is because the bean I created does not have the correct decleration types or IView interface calls. My problem is that when I load any of the Oracle provided beans I get the 13009 or 13010 errors. I have looked here and in Metalinks for some kind of solution that I haven't already tryed, but to no avail.
    Any advice on either of these problems would be appreciated. Please keep in mind that we cant upgrade to version 9 or 10 yet (silly aif force and their regulations), so those type of solutions arn't usable to me.
    Here is the configuration information that I know about. If there is more information that can be provided or I need to provide more information, please let me know and I will get what I can.
    Thanks,
    Bill Hunsicker
    ============= Config Information =======================
    Forms Version 6.0.8.25.2
    JBuilder Version and Information
    Oracle IDE     9.0.5.13.88
    Business Components Version     9.0.5.13.52
    UML Modelers Version     9.0.5.12.38
    Versioning Support     9.0.5.12.38
    WebDAV Support Version     9.0.5.12.38
    Designer Generators Framework     9.0.5.3.39
    java.version     1.4.1_02
    java.home     C:\Oracle\JDeveloper\jdk\jre
    java.vm.name     OJVM Client VM
    java.vm.vendor     Oracle Corp.
    java.vm.version     9.0.5.972 4dopv
    user.language     en
    user.region     <no value assigned>
    user.name     Bill.Hunsicker
    user.home     C:\Documents and Settings\Bill.Hunsicker
    user.dir     C:\Oracle\JDeveloper\jdev\bin
    os.name     Windows XP
    os.version     5.1
    os.arch     x86
    ide.patches     
    ide.user.dir     
    FORMS60_JAVADIR = C:\orant\FORMS60\java
    CLASSPATH = C:\orant\FORMS60\java;C:\orant\TOOLS\COMMON60\JAVA\IMPORTER.JAR;C:\orant\forms60\java\P3load.jar;C:\orant\forms60\java\f60all.jar

    Ok, I added the f60all.jar to the project. This allowed me to create the file using the VBean. I created the JAR file and copied it to the forms60/java directory. I also copied the new .class files to the forms60/java/mil/af/rs/leads direcory.
    I then edited my formsweb.cfg file and had to add the jinit_archive tag. I set it = f60all.jar, P3load.jar. I also added my P3load.jar file to the default archive tag.
    When I open up Forms, drop the bean area component on the canvas, and set the Implementation Class, I still get an error (13008), and when I run the form in web, and click the button to invoke the bean I get no response from the bean.
    here is the code to invoke the bean. in_filename is a text component on the canvas and contained in the CTRL block. The bean area is named BEAN (because the demo was that way).
    :in_filename := get_custom_property('BEAN',1,'getFileName');
    synchronize;
    Not sure where to go from here, but thanks for the help so far.

Maybe you are looking for

  • I can no longer print cover art.

    Started about a month ago. I see from some forums that a lot of people began having that problem around the same time. I just re-downloaded iTunes, but that didn't help. Any suggestions?

  • IPhone 4 address book won't sync with MacBook Air

    I've been Googlin' my butt off, and called support three times (in which they won't help me because they say it's an iPhone issue)... Anyway, just purchased a MacBook Air; and my iPhone contacts will not sync with the address book. Any help would be

  • Regarding logical path....LSMW

    dear all.. i m working on LSMW for BOM creation.. i have created two flat files for header and the child windown (component). but when i m creating session, its asking for a logical path.. i have tried it with the t code FILE.. but its not working. c

  • How to make a JList realtime searchable

    I have a JList with data initialized from a Vector<String> and a JTextField which fires an event when a character i typed. What I need is for the JList to be trimmed down in realtime. When I type 'E' I want everything in the list that begins with an

  • CA Cryptographic service provider?

    Hello, I am planning to install Single tier Enterprise CA on a dedicated Windows 2008 R2 Server. We still have Windows XP SP3 workstations and I have some questions about the "cryptography" options on the Certificate Authority installation wizard. Th