FileUpload Question

This is a question for people who have used/ worked on the
fileupload.fla file that comes with flash. I am trying to make a
remove button for the file. Right now it only has the browse
button, any help is really apprieciated. Thanks
Randy

No one has ever worked with this?

Similar Messages

  • FileUpload, Question about FormsDecoder.getFormsDecoderVersion

    Hello,
    I have successfully tested the FileUpload example provided in OTN.
    I would like to go a little further in my understanding, so I decided to manipulate the code...
    With my questions, you may think that I'm pretty new in java !! (that's true !!! )
    Here it is :
    In form fileuploader.fmb, under trigger WHEN-NEW-FORM-INSTANCE, there is a command to retrieve the FormsDecoderVersion:
    vcDecoderVersion := FormsDecoder.getFormsDecoderVersion;
    I looked at file FormsDecoder.java, provided in the demo, and also around... and I haven't found any method called getFormsDecoderVersion....
    Question 1 : I would like to understand why ?
    Within Forms, I tried to import a jar, and noticed that Forms automatically creates a package/package body.
    I noticed that when I don't import a jar (for instance FormsDecoder), the forms compiles successfully, and when I import FormsDecoder, then compilation fails (because it doesn't find getFormsDecoderVersion)...
    Question 2 : When shall I import a jar into Forms developer ? Shall I think about something specific before importing a jar into Forms Developer ?
    I hope that I'm clear enough...
    Thanks a lot for your help,
    Best Regards,
    Olivier

    Hi,
    I figured out how to answer question 1.... I was too much focused on the java code, I forgot the library fileupload.pll
    And as a consequence, I think I got the explanation for question 2....: Importing a jar, helps to automatically build a link between the jar and Forms.
    Anyway, I still would like to understand why, when I import a jar for class FormsDecoder, I don't exactly get what I can find in the fileupload.pll .... (missing procedures/methods and also, not the same way to write the procedure body)...
    Does this mean that I don't have the same version of the jar file ?I hope you can help me,
    Olivier

  • Commons-Fileupload question

    Hi,
    I'm trying to use the commons-fileupload-1.1.jar file and I've placed it in my WEB-INF/lib folder. When I try to compile my java though, I get an error that reads: package org.apache.commons.fileupload does not exist. I'm importing like this:
    import org.apache.commons.fileupload.DiskFileUpload;
    I've searched for answers on this already but can't find anything. I don't know if I'm placing it in the wrong folder or what. I'm using Tomcat so I also tried placing the jar file in the common/lib and server/lib folders but neither solved the problem. I've read that I may need to set in my classpath, but I don't know how to do this. Any help is appreciated. Thanks

    I'm trying to use the commons-fileupload-1.1.jar
    ar file and I've placed it in my WEB-INF/lib folder.
    When I try to compile my java though, I get an error
    r that reads: package
    org.apache.commons.fileupload does not exist.
    I'm importing like this:
    import org.apache.commons.fileupload.DiskFileUpload;Placing the jar in the WEB-INF/lib is the correct thing to do. But this would take care of the runtime. For compilation, you HAVE to set the jar to the classpath.
    javac -classpath "%CLASSPATH%;c:\Tomcat\MyApp\WEB-INF\lib\commons-fileupload-1.1.jar" MyClass.javaThis is how your command should look.
    I would rather suggest you to use Ant and create a simple build script to take care of all the compilation and classpath part.

  • JavaScript FileUpload Question...

    Hi there!
    I'm uploading a file using the JavaScript code below. Is it possible to change the default browse button, to for example an image? If not, can the uploading be done using another language?
    ...<INPUT TYPE="file" NAME="x">....
    Best regards
    Paul

    Hi,
    Check out this link.
    http://developer.iplanet.com/docs/examples/java/file_uploading.html
    Hope this helps.
    Regards,
    Roopasri Vittal
    Developer Technical Support
    Sun Microsystems
    http://sun.com/developers/support

  • Question about Jakarta common fileUploader

    Hello!
    I want to be able to upload files to my databas through a jsp-page and have beeing recommended to use Jakarta common fileUploader.
    When extracting that file I saw that there was a lot of files, should all files be put in my WEB_INF/classes/"mypachage"-catalogue or?
    Thanks in advance!
    /D_S

    I am not sure what you mean. When you downloaded the commons-fileupload-1.0.zip there should be some JavaDoc files and a jar file (commons-fileupload-1.0.jar). You dont need to unzip the jar file. Just place it in WEB-INF/lib so the classes will be load. You'll also need to add the jar file to you classpath (or IDE classpath) so that you can compile.
    (Adjust the file names for what ever version you are using)

  • QUESTION ON FILEUPLOAD

    HI to all i want help urgently on file upload system its working but i want to insert file in to database and retrive that file and store it another page it could be in jsp please answer my question
    Advance Thanks

    i wrote this code its working but i want insert image in to data base and retrive it please helpme advance thax
    Enumeration files = multi.getFileNames();
    while (files.hasMoreElements())
    String name = (String)files.nextElement();
                             filename = multi.getFilesystemName(name);
                             image = filename;
                             String type = multi.getContentType(name);
                             System.out.println("type:"+type);
         System.out.println(image+ "hi");          
                             File f = multi.getFile(name);
                             FileReader fs = new FileReader(f);     
                             BufferedReader in = new BufferedReader(fs);                                                  
                             String s = new String();
                             String s2 = new String();
                             while((s = in.readLine())!= null)
    System.out.println("enter in to while block");
                             s2 += s + "\n";                         
                             String fileContent = s2;
                             in.close();
    File f2 = new File(savePath + image);

  • Sending an email with attachments in Java using FileUpload UI Element

    Hello Experts,
    I'm using NWDS 7.01 SP6.
    I have an application that has a FileUpload ui element. The elements resource property is bound to a context node of type Resource from the Local Dictionary from uielementsdefinitions.
    The question I have is, how can I take the uploaded file from the context, and attach it to an email using the javax.mail.* api?
    Do I need to store it somewhere first or can it be taken directly from the context attribute? If I need to store it, where do I store it? 
    Any help or suggestions are appreciated.
    Thanks
    MM

    Hello Experts,
    I'm using NWDS 7.01 SP6.
    I have an application that has a FileUpload ui element. The elements resource property is bound to a context node of type Resource from the Local Dictionary from uielementsdefinitions.
    The question I have is, how can I take the uploaded file from the context, and attach it to an email using the javax.mail.* api?
    Do I need to store it somewhere first or can it be taken directly from the context attribute? If I need to store it, where do I store it? 
    Any help or suggestions are appreciated.
    Thanks
    MM

  • How to invoke the FileUpload field click event without clicking on the browse button?

    The Fileupload field click() method works in IE, but not in firefox. Can someone provide some details on this issue?

    A good place to ask questions and advice about web development is at the mozillaZine Web Development/Standards Evangelism forum.
    The helpers at that forum are more knowledgeable about web development issues.
    You need to register at the mozillaZine forum site in order to post at that forum.
    See http://forums.mozillazine.org/viewforum.php?f=25

  • Is there any way to get FileUpload.PosetedFile.Inputstream property as string?

    Hello,
    In my project i have used asp.net Fileupload control which works fine on my local machine. but when run that project on server i am not able to load the xls file. so i have used "Fileupload1.PostedFile.InputStream" property which returns as a Stream.
    By using this i can load excel file properly. but now i have to use as "string" instead of "stream" for further implementation. so how i can use "Fileupload1.PostedFile.InputStream" which returns Stream, and i can convert it into
    string and pass it to load excel file to run it properly on server also? can any one please help me?

    This forum is to discuss problems of C# development. Your question is not related to the topic of this forum.
    You'll need to post it in the dedicated ASP.Net Forum
    http://forums.asp.net for more efficient responses, where you can contact ASP.NET experts. Thanks for understanding.

  • FileUpload element is not working.

    Hi, experts,
    There is WD-application with FileUpload element that is not working so that the rar file isn't uploaded into MIME Repository.
    Action:
    1. Create content attribute that type is xstring in the view context.
    2.  Create MIMETYPE,  FILENAME attribute that type is string in the view context.
    3.  Bind the content attribute  to the data property of the fileupload element in the layout.
    4.  Bind the filename to the filename property of the fileupload element in the layout.
    5.  Bind the mimetype to the mime type property of the fileupload element in the layout.
    The following is code for the upload button in the view:
    method ONACTIONFILEUPLOAD .
    data:   content  type xstring.
    DATA lo_nd_mimes           TYPE REF TO            if_wd_context_node.
    DATA lo_el_mimes           TYPE REF TO            if_wd_context_element.
    DATA ls_mimes              TYPE                   wd_this->element_mimes.
    DATA lv_mimetype          LIKE ls_mimes-mimetype.
    get the context
    wd_context->get_attribute( exporting name = 'FILECONTENT' importing value = content ).
    lo_nd_mimes = wd_context->get_child_node( name = wd_this->wdctx_mimes ).
    lo_el_mimes = lo_nd_mimes->get_element(  ).
    set single attribute
      lo_el_mimes->set_attribute(
        EXPORTING
          name =  `MIMETYPE`
          value = 'APPLICATION/octet-stream;charset=utf-16le' ).
      lo_el_mimes->set_attribute(
        EXPORTING
          name =  `FILENAME`
          value = 'test.rar' ).
    put the rar file to  the repository .
    data:
    mime_repository        type ref to           if_mr_api,
    mime_type                type                  string,
    url                            type                  string value '/sap/bc/webdynpro/sap/zz_00_test_019' ,             
    mime_repository = cl_mime_repository_api=>IF_MR_API~GET_API( ).
    mime_repository->put(
              EXPORTING
                i_url                         = url
                i_content                     = content
                i_suppress_package_dialog     = 'X'
              EXCEPTIONS
                parameter_missing             = 1
                error_occured                 = 2
                cancelled                     = 3
                permission_failure            = 4
                data_inconsistency            = 5
                new_loio_already_exists       = 6
                is_folder                     = 7
                OTHERS                        = 8 ).
    break-point.
    endmethod.
    So the questions are:
    I don't find the rar file in the mime repository after I run the Webdynpro for ABAP application.
    I am sure that the field where is put the rar file is right.
    Do you give me some hint?
    Thanks!
    Best regards,
    tao
    Edited by: wang tao on Feb 13, 2009 8:12 AM

    Hi Wang,
    Regarding your file uploading problem, please check this code.
    On a button action call this code to upload the file.
    Please take care of the URL you going to pass.
    The URL should be like this. i.e. You have to specific the dummy file name in the url as here in this example I am passing the Code.txt.
      url TYPE string VALUE '/SAP/BC/WebDynpro/SAP/WDR_TEST_ADOBE_PDF_ONLY/CODE.TXT' .
    METHOD onactiononclick .
      DATA lo_nd_node TYPE REF TO if_wd_context_node.
      DATA lo_el_node TYPE REF TO if_wd_context_element.
      DATA ls_node TYPE wd_this->element_node.
      navigate from <CONTEXT> to <NODE> via lead selection
      lo_nd_node = wd_context->get_child_node( name = wd_this->wdctx_node ).
      get element via lead selection
      lo_el_node = lo_nd_node->get_element(  ).
      get all declared attributes
      lo_el_node->get_static_attributes(
        IMPORTING
          static_attributes = ls_node ).
      lo_el_node->set_static_attributes(
      EXPORTING
        static_attributes = ls_node ).
      DATA:
      mime_repository TYPE REF TO if_mr_api,
      mime_type TYPE string,
      url TYPE string VALUE '/SAP/BC/WebDynpro/SAP/WDR_TEST_ADOBE_PDF_ONLY/CODE.TXT' .
      mime_repository = cl_mime_repository_api=>if_mr_api~get_api( ).
      CALL METHOD mime_repository->put
        EXPORTING
          i_url                     = url
          i_content                 = ls_node-data
        i_language                = sy-langu
      EXCEPTIONS
        parameter_missing         = 1
        error_occured             = 2
        cancelled                 = 3
        permission_failure        = 4
        data_inconsistency        = 5
        new_loio_already_exists   = 6
        is_folder                 = 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.
    ENDMETHOD.                    "onactiononclick
    This will help you in solving your problem.
    Regards
    Manoj Kumar

  • Apache commons fileUpload parseRequest finds no form fields-portalComponent

    Hello All,
    What am I trying?
    Developing a portal component (no JSP, no HTMLB).
    Have used Apache commons fileUpload libraries.
    What is the problem?
    parseRequest method works fine when I right click and preview from PCD.
    parseRequest method returns 0 html form elements when the portal component is tested under the TLN (via role -> workset -> iview)
    What else did I try?
    1.
    I looked in to Apache documentation - there are two different APIs for two different scenarios, Servlets and Portlets.
    My understanding is that I can not use portlets scenario in SAP Portal.
    Servlets scenario was what worked while doing a preview from PCD.
    2. I have looked into other solutions like using web dynpro and HTMLB to do file upload - not really a fan of either for various reasons.
    Can any one help?
    I am trying to understand why the HTTPServletRequest when parsed returns 0 form elements in the SAP Portal scenario.
    Thanks!

    Hello Ankur,
    You said:
    The reason for this is, unlike the request parameters, the multipart formdata is 'read-once-only' (because once
    the data is read off the ServletInputStream, it is gone! It cannot be read again). When you call a full portal request it goes through lot of gets before reaching your component.
    The above concept is not fully clear to me. I got a hint to something like this happening from this link that explains the need for portlets API scenario compared to a servlets scenario - Link: http://commons.apache.org/fileupload/using.html
    (Search for Servlets and Portlets within that link)
    I initially thought something like what you had replied would have happened. However, when I do a getContentLength on HTTPServletRequest in the SAP Portal mode (role -> workset -> iview), the size still includes that of the uploaded document. So like you said "it is gone! It cannot be read again" may not be accurate.
    My question still remains open.
    Edited by: Mohammed on Aug 24, 2009 6:29 PM

  • Apache commons FileUpload: Pass stream as attribute

    I'm trying to implement a Filter that will change all the HTTP parameters to attributs, so that I can handle them in a consistent way throughout my servlets. The apache commons fileupload part is giving me problems. I'm changing the parameters to attributes like this
    if(URLENCODED.equalsIgnoreCase(contentType) || contentType == null) // Used with normal form data
      Enumeration<String> params = request.getParameterNames();
      while(params.hasMoreElements())
        String name = params.nextElement();
        String value = request.getParameter(name);
        request.setAttribute(name, value);
    else if(contentType.toLowerCase().startsWith(MULTIPART))     // Used when file is uploaded with POST               
      // Create file upload handler
      ServletFileUpload upload = new ServletFileUpload();
      FileItemIterator iter;
      iter = upload.getItemIterator((HttpServletRequest) request);
      while(iter.hasNext())
        FileItemStream item = (FileItemStream)iter.next();
        InputStream itemStream = item.openStream();
        if(item.isFormField())          // form item
          BufferedReader rd = new BufferedReader(new InputStreamReader(itemStream));
          String line;
          while((line = rd.readLine()) != null)
            streamParamsToAttributes(line)
      else          // file
        request.setAttribute("filestream", itemStream);
    }In my servlet I use the file stream with following code
    InputStream itemStream = (InputStream)(request.getAttribute("filestream"));
    useStream(itemStream)Here the useStream() method will throw a FileItemStream.ItemSkippedException since I'm trying to read data from the stream after the iter.next() was called.
    So my question is, how to handle this kind of situation? The file can be quite big, so reading it to memory is not wise. And as I read, copying the stream is not a straight-forward task.
    I noticed that O'Reilly has also a library for handling file uploads, is it any better in this case?
    Thanks.

    I looked at the O'Reilly lib and it seems to always save the file to disk. So no streaming possibility.
    One solution I can think of would be to 'manually' read the data from the request. I can get the data with request.getReader() call. The file data can be found by the boundary. Now I'm wondering whether this will solve anything. Can anyone see some caveats in this approach?

  • Problems with Apache Commons FileUpload

    I'm completely stymied here. I've been trying to get the Apache Commons FileUpload working with a JBoss 4.2 server, and having no luck whatsoever. The servlet is listed out here:
    package com.areteinc.servlets;
    import java.io.IOException;
    import java.io.PrintWriter;
    import java.util.Iterator;
    import java.util.List;
    import javax.servlet.ServletException;
    import javax.servlet.http.HttpServlet;
    import javax.servlet.http.HttpServletRequest;
    import javax.servlet.http.HttpServletResponse;
    import org.apache.commons.fileupload.FileItem;
    import org.apache.commons.fileupload.FileItemFactory;
    import org.apache.commons.fileupload.FileUploadException;
    import org.apache.commons.fileupload.disk.DiskFileItemFactory;
    import org.apache.commons.fileupload.servlet.ServletFileUpload;
    import org.apache.log4j.Level;
    import org.apache.log4j.Logger;
    public class Filer extends HttpServlet {
         private Logger logger = Logger.getLogger(Filer.class);
         public Filer() {
              logger.setLevel(Level.DEBUG);
         protected void doGet(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
              logger.debug("Serving up a GET page...");
              PrintWriter writer = resp.getWriter();
              StringBuffer response = new StringBuffer();
              response.append("<HTML><HEAD><TITLE>JENA File Uploader</TITLE></HEAD><BODY>");
              response.append("<FORM action=\"Filer\" method=\"POST\" enctype=\"multipart/form-data\">");
              response.append("Upload file: <input type=\"file\" name=\"file1\"/><br>");
              response.append("Upload file: <input type=\"file\" name=\"file2\"/><br>");
              response.append("<input type=submit value=\"Start upload\">");
              response.append("</BODY>");
              writer.println(response);
         protected void doPost(HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException {
              // First see if someone is uploading more than one file at a time...
              boolean isMultipart = ServletFileUpload.isMultipartContent(req);
              logger.debug("Received a POST request.  Multipart is flagged as " + isMultipart);
              // Create a factory for disk-based file items
              FileItemFactory factory = new DiskFileItemFactory();
              // Create a new file upload handler
              ServletFileUpload upload = new ServletFileUpload(factory);
              // Parse the request
              try {
                   List<FileItem> items = upload.parseRequest(req);
                   Iterator itr = items.iterator();
                   logger.debug("Size of upload is " + items.size() + " items.");
                   while(itr.hasNext()) {
                        FileItem item = (FileItem) itr.next();
                        logger.debug("Filename is " + item.getName());
              } catch (FileUploadException e) {
                   e.printStackTrace();
    }When run, I hit it with a get operation, and get the form. When I put in 2 forms (in reality, all i want to do is use one, but I'm tinkering), I see nothing in items list...
    Run, with 2 files selected to upload:
    13:50:15,421 DEBUG [Filer] Received a POST request. Multipart is flagged as true
    13:50:15,421 DEBUG [Filer] Size of upload is 0 items.
    I've tried variation after variation after variation, and it jst doesn't work. I'm using commons-fileupload-1.2.1.
    Help! :)

    On the client side, the client's browser must support form-based upload. Most modern browsers do, but there's no guarantee. For your case,
    The servlet can use the GET method parameters to decide what to do with the upload while the POST body of the request contains the file data to parse.
    When the user clicks the "Upload" button, the client browser locates the local file and sends it using HTTP POST, encoded using the MIME-type multipart/form-data. When it reaches your servlet, your servlet must process the POST data in order to extract the encoded file. You can learn all about this format in RFC 1867.
    Unfortunately, there is no method in the Servlet API to do this. Fortunately, there are a number of libraries available that do. Some of these assume that you will be writing the file to disk; others return the data as an InputStream.
    Jason Hunter's MultipartRequest (available from [http://www.servlets.com/])
    Apache Jakarta Commons Upload (package org.apache.commons.upload) "makes it easy to add robust, high-performance, file upload capability to your servlets and web applications"
    *CParseRFC1867 (available from [http://www.servletcentral.com/]).
    *HttpMultiPartParser by Anil Hemrajani, at the isavvix Code Exchange
    *There is a multipart/form parser availailable from Anders Kristensen ([http://www-uk.hpl.hp.com/people/ak/java/] at [http://www-uk.hpl.hp.com/people/ak/java/#utils].
    *JavaMail also has MIME-parsing routines (see the Purple Servlet References).
    *Jun Inamori has written a class called org.apache.tomcat.request.ParseMime which is available in the Tomcat CVS tree.
    *JSPSmart has a free set of JSP for doing file upload and download.
    *UploadBean by JavaZoom claims to handle most of the hassle of uploading for you, including writing to disk or memory.
    There's an Upload Tag in dotJ
    Once you process the form-data stream into the uploaded file, you can then either write it to disk, write it to a database, or process it as an InputStream, depending on your needs. See How can I access or create a file or folder in the current directory from inside a servlet? and other questions in the Servlets:Files Topic for information on writing files from a Servlet.
    Please note: that you can't access a file on the client system directly from a servlet; that would be a huge security hole. You have to ask the user for permission, and currently form-based upload is the only way to do that.
    I still have doubt if all the moentioned resources are alive or not

  • Commons-fileupload-1.2.1. 4 kB limit

    Hi everybody.
    I am using apache commons-fileupload-1.2.1.jar to upload files (multipart data). I have copy/pasted the code from their example page:
    [http://commons.apache.org/fileupload/streaming.html]
    However, I have problems. When I open the inputStream to a file, and check for stream.available(), it always returns 3904 - 3916. And then I write that data down to a blob and from there save it to a file and the file is always 4 kB long.
    I have checked the limits of my Apache Tomcat. It allows files up to 20 MB.
    I have used this code to get the data:
                File tem = new File("/");
                FileItemFactory factory = new DiskFileItemFactory(10000000,tem);
                // Create a new file upload handler
                ServletFileUpload upload = new ServletFileUpload();
                // Parse the request
                // maximum size before a FileUploadException will be thrown
                upload.setSizeMax(10000000);
                upload.setFileSizeMax(10000000);
                upload = new ServletFileUpload(factory);
                // Parse the request
                FileItemIterator iter = upload.getItemIterator(request);
                while (iter.hasNext()) {
                    FileItemStream item = iter.next();
                    String name = item.getFieldName();
                    InputStream stream = item.openStream();
                    if (item.isFormField()) {
                         // source to do with form fields   
                    } else {
                        BufferedInputStream bis = new BufferedInputStream(stream, 1000000);
                        out.println("Stream has: " + stream.available());
                        // prints out 3904 - 3916, depends on the file
                        byte[] temp = new byte[stream.available()];
                        int bytesRead = stream.read(temp );
                        out.print("Number of bytes read: " +bytesRead + "<br>");
                        // prints out 3904 - 3916, depends on the file
                Any ideas what to add or where the 4 kB limit is?

    It's indeed a blocking/buffered stream. Commons FileUpload comes along with excellent documentation and examples of how to use it. Go read them. Especially the 'User Guide' and 'Frequently Asked Questions' sections at their homepage.
    If you really want to know the content length beforehand, you need HttpServletRequest#getContentLength(). Only keep in mind that the client has full control over the request header values, so your code shouldn't rely that much on this.
    That said, in the future you should be posting Servlet related questions at the Servlet forum.

  • How to open a file browser in CRM Web UI without THTMLB tag "fileUpload"

    Hello,
    can someone help me solving this question:
    How can I open a file browser in CRM Web UI without using the THTMLB tag "fileUpload"?
    The THTMLB tag has the disadvantage that after having uploaded the file the file name disappears.
    Thanks a lot.
    Best regards,
    Michael.

    Hello, Michael.
    I've got what you mean now. Seems that this is a standard behaviour of this tag. And it has a background which I can only guess - you press Upload, upload is done, field is emptied shown that it is ready to upload next file.
    I suppose you should handle such situation in your onUpload method. And set some indicator (text field below the fileupload tag, icon somewhere near, disabling fileUpload's bttons etc.) on the screen accordingly.
    For instance, your button "Start import" at the bottom of the window already knows about it (it switches from disabled to enabled when you press "Upload").

Maybe you are looking for