Get upload file from a RichFileInput(s) created dinamically  (11.1.1.2.0g)

Hello to all,
I saw the tutorial for managing the file by RichFileInput (opn http://download.oracle.com/docs/cd/E12839_01/web.1111/b31973/af_input.htm#BABDFAEI) I think that the key is the association between the attribute value of af:inputFile element and file attribute of bean.
public class ProcessFileUpload {
private UploadedFile _file    ------------> mapped to ---->  <af:inputFile value="#{ProcessFileUplade.file}"...
But I cannot add mappings because I add a lot of RichFileInput dynamically to the page, so I don't know how many files I'l have.
So, is it possible to map the value attribute to an element of an ArrayList<UploadedFile>? How can I do this by EL in java?
Thank you,
Cristian
Edited by: baol on Apr 9, 2010 6:43 AM
Edited by: baol on Apr 9, 2010 6:44 AM

I reply to myself:
Use a Array:
private UploadedFile[] files = new UploadedFile[10];
And then add use this on every RichInputFile ;
private UIComponent addFileAssociation(UIComponent comp, int id) {
FacesContext ctx = FacesContext.getCurrentInstance();
Application application = ctx.getApplication();
ExpressionFactory ef = application.getExpressionFactory();
String veString = "#{backingBeanScope.backing_document.files["+id+"]}";
ValueExpression ve = null;
try{
ve = ef.createValueExpression(FacesContext.getCurrentInstance().getELContext(), veString, Object.class);
} catch (Exception e){
e.printStackTrace();
comp.setValueExpression("value", ve);
comp.setId("file_"+id);
return comp;
Yest it works :)
Cristian

Similar Messages

  • How to get InputStream of uploaded file from request?

    The situation:
    Client is uploading xml file to server.
    <form METHOD=POST ENCTYPE = "multipart/form-data" action="SendFile" accept="text/xml">
              <input type="file" name="SentFile" />
              <input type="submit" value="go"/>
    </form>Then I need to parse data from file.
    I want to use method javax.xml.parsers.DocumentBuilder.parse(InputStream is)
    But, how to get InputStream of uploaded file from request?

    You cannot get the InputStream of the uploaded file directly. The InputStream you can obtain from request.getInputStream() contains a lot of other data as well as the uploaded file. You will have to parse the data in the InputStream to find the data that belongs to the file.
    A short cut is to use the HTTP Multipart File Upload available from www.jenkov.com. It simplifies file upload and makes it easy to obtain an InputStream for only the uploaded file. It also handles upload of multiple files. It is free, open source, Apache license, so if it doesn't fit your needs, you can always read the code and see how it works. Then write your own upload servlet.

  • Why is a new user account created every time I upload files from my old PC. Can't you just use the same user account all the time?

    I'm a new Mac user and am finding my way slowly around it. One question: why is a new user account created every time I upload files from my old PC?

    Because you're using the Migration Assistant, and it can't migrate data to an existing user account. Transfer everything at once or use a different method.
    (111200)

  • How to get a file from an internet site

    I have a scenario where I need to get a file from a website.
    Basically on a weekly basis one our customers are going to upload a file that contains all the information for delivery's for the coming week.
    the way this used to be done is the user would go to the website directly and download the uploaded file.
    However now we want to do it as an automatic integration using PI.
    Does anyone have an idea how to do this?  Is it even possible?

    > Thridly my issue with regards to taking a file that is uploaded to a website (it will be a csv file), can be solved by creating a webservice?
    I am sorry, I misunderstood this. I thought you want to download.
    The upload is done with a HTTP POST, so you can use the HTTP receiver adapter.
    Use the prolog and epilog to simulate the form data post.
    Use an HTTP sniffer to get the whole HTTP stream, when you upload the file to the website to see, what you have to put in the HTTP adapter settings.
    Here are some threads about that topic:
    Receiver HTTP Adapter - multipart/form-data file post - SP19
    Re: HTTP Form Post Using HTTP adapter
    Regards
    Stefan

  • Unable to upload files from local computer to remote server (Was: Dreamweaver)

    I have lost the connection between the remote location and the local location for files on my computer. Where to I correct this issues, since I cannot upload files from local to remote. Host server from server to my computer works fine, Running Dell computerr XP operating system with CS3 Dreamweaver. Need all the help I can get.

    I am now having a "ftp error - cannot make connection to host. Dreamweaver
    encoutered a netwoerk or file system error. I did as you suggested and I
    get to basic site definition, ( which looks o.k.), next screen ( no,I do
    not want to use a server technology) Next screen ( edit local copies on my
    machine ( file location looks o.k.), next screen (connect to remote
    server=ftp) address of web server is correct, ( no folder on server, or ftp
    login or ftp password) do not enable check in or check out
    summary: local
    Site name:midhba
    local root folder:midhba
    remote info:
    access; ftp
    FTP host: midhba.com
    check in.check out diabled
    testing server (set up later)

  • I can't export any files from pages unless I create a duplicate file. I can't export to doc, docx or pdf! Heeeelp!

    I can't export any files from pages unless I create a duplicate file. I can't export to doc, docx or pdf! Heeeelp!

    what version of pages?
    what is the files type that you are trying to export?
    what do you mean unless I create a duplicate file? the whole point of export is that you get a new file with a new format

  • How to get uploaded file details in custom page

    Hi,
    I need to navigate to custom page after multiple file upload and display details of file uploaded in the custom page.
    Is there any variable which indicates the files uploaded that can be used in my custom page?
    Thanks in advance,
    dhijit

    Hi,
    According to your description, you want to get uploaded file details after uploading the files in a custom page.
    I suggest you create an event receiver in the custom page so that you can get file details when the files are added to the document library.
    Here is a code snippet for your reference:
           public override void ItemAdded(SPItemEventProperties properties)
               base.ItemAdded(properties);
               string fileURL = properties.ListItem.Web.Url + "/" + properties.ListItem.File.Url;
    More information about how to create an event receiver:
    http://bramnuyts.be/2011/04/01/add-an-event-receiver-to-a-specific-list-programmatically/
    Here is a similar thread about get uploaded files field:
    http://social.technet.microsoft.com/Forums/en-US/ad447c63-158c-4d92-8354-7d7f5b18e517/how-to-get-the-fileid-of-upload-files?forum=sharepointdevelopmentprevious
    Best regards,
    Zhengyu Guo
    Zhengyu Guo
    TechNet Community Support

  • Problem uploading files from Dreamweaver CS3 to Yahoo

    I am having a problem uploading files from Dreamweaver CS3 to
    an FTP site on Yahoo.
    The error message I get is "No response from server.
    Reconnecting..."
    I am able to connect to Yahoo using other FTP clients
    successfully.
    I am able to connect to Yahoo using Dreamweaver MX 2004
    successfully.
    I tried playing with various settings (i.e. passive ftp,
    server compatibility options) but to no avail.
    Any thoughts on this would be appreciated.
    Thank you,
    Steven

    I tried enabling passive FTP but it doesn't help.

  • Uploading files from the iPad to the web

    I'm interested in uploading files from my iPad to the web. Specifically, I run a wiki to manage many documents and often upload them from my computer. This means having to email documents from my iPad to my computer. I have a dropbox account already, but it won't serve as a place to pull files from. Is there an app or a browser that can create a way to upload files directly?

    synching doesn't seem to  make a difference it doesn't copy whats on the ipad over.
    The problem is when  i go in to itunes and click on ipad then on books theres a ton of pdfs that are there that are on the ipad but i cant find when i go to ibook, i don't want to delete them off with out knowing what they are and the fact is  i dont seem t0 have a copy on my computer anymore

  • Get all files from Directory

    Hi All,
    My requirment is to get releted files from Local Directory.
    For Example Path is "D/Data/"
    in this path there is files like
    abc123_de.txt
    abc123_en.txt
    xyz123_de.txt
    abc123_pt.txt
    xyz123_en.txt
    pqr123_en.txt
    bcg234_en.txt
    sjd467_en.txt
    Now i want to use only files which are strart from abc123 and use their data.
    From which FM i can do it or how can i do this?
    Thanks,
    Mahipalsinh

    Dear Mahipalsinh,
    I have got the same requirement some days back, i think there is no FM for your requirement. so what i did, i have get all the files using below FM and Concatenate the ABC.
    Please use the Below FM, because if the file name is above that 50 character that time always it gives the full file name. Please check, if u used the other one for getting the Files.
       CALL FUNCTION 'EPS2_GET_DIRECTORY_LISTING'
         EXPORTING
           iv_dir_name            = lv_dir_name
         TABLES
           dir_list               = lt_file_name
         EXCEPTIONS
           invalid_eps_subdir     = 1
           sapgparam_failed       = 2
           build_directory_failed = 3
           no_authorization       = 4
           read_directory_failed  = 5
           too_many_read_errors   = 6
           empty_directory_list   = 7
           OTHERS                 = 8.
       IF sy-subrc <> 0.
    * Implement suitable error handling here
       ENDIF.
    For reading Specific Files.
    CONCATENATE 'AP' lv_internal_date INTO lv_filename.
             LOOP AT  lt_file_name INTO ls_file_name.
               lv_index = sy-tabix.
               IF ls_file_name-name CS lv_filename.
              " PUT YOUR LOGIC
              endif.
         endloop.
    Thanks,
    Nishant

  • How to upload file from a client machine to server machine

    hei evryone!
    can anyone pls help me on how i can upload file from a client machine to another machine (or server). using jsp.Then later on, i can also retrieve the names of these files to place it as values for option tag in an html form.I have a seperate screen for uploading the file and the screen for displaying all the files that were uploaded on the server...
    any sample code/ ideas would be much appreciated.Thx!!!!

    hei evryone!
    can anyone pls help me on how i can upload file from a client machine to another machine (or server). using jsp.Then later on, i can also retrieve the names of these files to place it as values for option tag in an html form.I have a seperate screen for uploading the file and the screen for displaying all the files that were uploaded on the server...
    any sample code/ ideas would be much appreciated.Thx!!!!

  • How to upload file from client to server in servlets.

    actually in my application i have to upload file from client m/c to server.
    it is not possible through file i/p stream as fileStreams does not work on network. Please mail me if you have any solution to this.
    Thank's in advance............

    Haii roshan
    Pls go through this thread..
    http://forum.java.sun.com/thread.jspa?forumID=45&threadID=616589
    regards
    Shanu

  • How to upload file from Application Server?

    Dear Friends,
    How to upload file from Application Server?
    Plz. with example...
    Regards,
    Dharmesh

    hi,
    check the code for upload from application server.
    tables: kna1.
    types: begin of s_file,
             customer type kna1-kunnr,
             country  type kna1-land1,
             name     type kna1-name1,
             region   type kna1-regio,
           end of s_file.
    *--Internal tables
    data: it_file type s_file occurs 0 with header line.
    *-- Selection screen
    selection-screen: begin of block b1 with frame title text-001.
    parameter: p_file type rlgrap-filename default 'C:/customer.txt'
    obligatory.
    selection-screen: end of block b1.
    *-- At selection screen
    at selection-screen on value-request for p_file.
    perform file_help using p_file.
    *-- Process File
    start-of-selection.
      perform upload_file using p_file.
    *-- write File data to o/p
    end-of-selection.
      perform write_data.
    *&      Form  file_help
    form file_help  using    p_p_file.
      data: l_filepath type ibipparms-path.
      call function 'F4_FILENAME'
    EXPORTING
      PROGRAM_NAME        = SYST-CPROG
      DYNPRO_NUMBER       = SYST-DYNNR
      FIELD_NAME          = ' '
       importing
         file_name           = l_filepath
      p_p_file = l_filepath.
    endform.                    " file_help
    *&      Form  upload_file
    form upload_file  using    p_p_file.
      call function 'WS_UPLOAD'
       exporting
         filename                      = p_p_file
         filetype                      = 'DAT'
    IMPORTING
      FILELENGTH                    =
        tables
          data_tab                      = it_file
       exceptions
         conversion_error              = 1
         file_open_error               = 2
         file_read_error               = 3
         invalid_type                  = 4
         no_batch                      = 5
         unknown_error                 = 6
         invalid_table_width           = 7
         gui_refuse_filetransfer       = 8
         customer_error                = 9
         no_authority                  = 10
         others                        = 11
      if sy-subrc <> 0.
        message i001.
      endif.
    endform.                    " upload_file
    *&      Form  write_data
    form write_data .
      loop at it_file.
        write:/ it_file-customer, it_file-country, it_file-name,
                it_file-region.
      endloop.
      endform.
    regards,
    keerthi.

  • How can i upload files from one ip address to another  ip address machine ?

    how can i upload files from one ip address to another ip address machine ?

    i need to copy files from one client m/c to server m/c like sftp
    please suggest solution on this

  • Is there any way to get the files from other computer ?

    Hai all,
    I have 2 computers connected. I know the IP address of other computer. Is there any way to get the files from other computer. (for e.g. I want to get the files from specific folder. In Java netwroking is it possible? (Any programs)
    regards,
    Namanc

    Bro Take it easy.
    Think you need to send a Image file named ("abc.gif")
    now develop a server using ServerSocket and connect it in local IP and any PORT
    For example i think ur server is connected in "localhost" and 9000 port.
    Now make ur server educated using some commands.
    For example:
    FileName: <File Name String>
    [Means new file is sending by connected client]
    FileSize: <File size long or int value>
    [ So that ur server can determind about the total length of sender file]
    DataModeOpen
    [Now your client will send its image data, this command means your client software is sending data]
    fjadlkfjaofaijojfwoeiurfodkjflsajlfksa
    l23j4lj23lkjlasjfoq23j4rokjelfkjasldkf
    2o3j4lk2j3ljslakdjf2l3j4 l23kjlk23k4j
    DataModeClose
    [Means file sending finished]
    Close
    [Means your client connection is closed]
    Now develop a client supporting this command.
    For example(Server):
    String getFileName=null;
    long getFileSize=0;
    public handleCommand(String getCmd) {
        if(getCmd.startsWith("FileName")) {
                String[] splitData=getCmd.split(":");
                this.getFileName=   splitData[1];
                outPutStream.writeBytes("+OK");
        } else if(getCmd.startsWith("FileSize")) {
                String[] splitData=getCmd.split(":");
                this.getFileSize=Long.parseLong(splitData[1]);
                outPutStream.writeBytes("+OK");
        } else if(getCmd.startsWith("DataModeOpen")) {
               //data mode open so receive data
              receiveData();
              outPutStream.writeBytes("+OK");
        } else if(getCmd.startsWith("DataModeClose")) {
              //close client socket
             getClientSocket.close();
    }For client:
    DataInputStream dataIn=null;
    BufferedOutputStream bout=null;
    public sendFile(bytes[] getBytes) {
            //if ok found then do other or show error message
        if(sendCmd("FileName:"+getFileName)) {
            if(sendCmd("FileSize:"+getFileSize)) {
                if(sendCmd("DataModeOpen")) {
                   bout.write(getBytes);
                } else {
                   showError(3);
            } else {
                   showError(2);
       } else {
            showError(1);
    }i think it will help u

Maybe you are looking for