Declarative Component : UploadedFile Isssue for multiple file Upload case.

Hi,
I have made one declarative component for the multiple file upload case; where i have add button that dynamically adds af:inputFile component to the popup dialog and similarly delete button to dynamically delete the selected inputFile component. Everything work fine such as:
1. add button adds the inputfile component properly and delete does the same.
2. upload of Multiple files also works fine. ( I keep the uploadedFile in the java.util.Map which is the pageFlowScope and once, Dialog box ok/cancel is clicked, i clear everything back).
IT WORKS GREAT WHEN:
User hit 5 times add button if they want to upload 5 images. and do upload for all the 5 inputFile components . (Add or Delete button should not be clicked after any upload , but before you can.)..
THE ONLY PROBLEM IS WHEN:
1. user uploaded; say 2 images but not yet clicked in the ok/cancel button yet... they are still in the upload dialog ..and hit ADD button again.
2. After that user uploads say another file/image and now UploadedFile's getInputStream() returns null, length becomes 0 for all the other uploadedFile except this newly uploaded file.
Now, here is the thing, i wrote my own customUplodedFile class which is just a wrapper and it return getInputStream() from this class and length from this class and it is working.... But i am not sure why does the uploadedFile loses it's value...
import org.apache.myfaces.trinidad.model.UploadedFile;
public interface ICustomUploadedFile
  extends Serializable, UploadedFile
  public String getFilename();
  public String getContentType();
  public long getLength();
  public Object getOpaqueData();
  public InputStream getInputStream();
  public void dispose();
====================
public class CustomUploadedFile
  implements ICustomUploadedFile, Serializable
  private transient UploadedFile mUploadedFile;
  private transient InputStream mInputStream;
  private long mLength;
  public CustomUploadedFile()
  public CustomUploadedFile(UploadedFile pUploadedFile)
    this.mUploadedFile = pUploadedFile;
    this.mLength = pUploadedFile.getLength();
    try
      this.mInputStream = pUploadedFile.getInputStream();
    catch (IOException e)
      e.printStackTrace();
  public String getFilename()
    return mUploadedFile.getFilename();
  public String getContentType()
    return mUploadedFile.getContentType();
  public long getLength()
    return mLength;
  public Object getOpaqueData()
    return mUploadedFile.getOpaqueData();
  public InputStream getInputStream()
    return mInputStream;
  public void dispose()
    mUploadedFile.dispose();
} Now, my questions are:
1. Is there a way i could follow to not to lose the UploadedFiles's inputStream and length by not using my wrapper class but in a standard way/best way.
2. I am not happy although it works because it is not making sense to me at all.....Why does the wrapper working though when i have transient variables; like UploadedFiles... and it's transient variables are lost why not mine.
I am totally confused at this stage.. Need your help.
Thanks

any one??

Similar Messages

  • Applet for multiple file upload

    Hi All
    I have a requirement for multiple file upload where user can select multiple files as well as folders.
    Would appreciate any pointers.
    Thanks.

    Google "java file upload"

  • How to add a field for multiple file upload in WebApps ?

    I am creating a WebApp for user to save some information with multiple pitcures. I can only see a single uploader.
    How can I add multiple image uploader and How can I create a custom file upload field rather than image upload ?

    Hi,
    There's no other upload field type for web apps.  You'll need to use the "image file type" to apply multiple file upload fields within the web app form in this case.
    Kind regards,
    -Sidney

  • Unable to browse for multiple file upload

    SharePoint 2010, Windows 7 Enterprise 64bit, IE 11 32bit - on this PC i have 1 user who does not get the option to browse and select multiple files to upload to a library. I can log on to the same PC and do that function no problems.
    I have checked all the things in other posts like the  stsupld.dll version, trusted sites, active X, compatibility mode etc etc.
    The upload multiple documents is not greyed out and this user has been able to do this before on a different PC which is same desktop SOE. Appears to related to part of the users profile maybe in the appdata.
    Scratching the head now and not sure where to look next.
    Any help appreciated

    Hi,As you said is correct.It seems the issues is with the user profiles in the PC.I think no use of  removing the user from site collection and re-added back also because,As you said he can able to Do the same function in different PC.I would suggest
    to re-add the user in PC.
    Anil Avula[MCP,MCSE,MCSA,MCTS,MCITP,MCSM] See Me At: http://expertsharepoint.blogspot.de/

  • "Upload" Button not rendering in firefox for multiple file upload

    This is driving me nuts. The "Upload" Flash button is not appearing in one of my apps in firefox only. The even weirder thing is I have another app which it does work. I've tried copying the includes folder for the app that works over to the one that doesn't. Deleting the includes and doing a basic test dynamic form and then adding the multiple upload beahviour.
    When i test it, the "upload" button simple isn't there. any one else run into this?

    OK, sorry, i guess it was a firefox cache issue. I right clicked on the window for the upload and hit "reload". The "upload" flash button now appears.
    man, that was driving me nuts.

  • Multiple file upload

    I need to upload multiple files from my system in ADF application, but "inputFile" component allows only one file. is it possible implement a multiple file upload similar to gmail file attachements?. Any help/pointers are appreciated.
    Thanks,
    Surya

    I can think of a solution using ADF
    One thing you can do is to have a managed bean has List<UploadedFile> files
    And you can generate your inputFile to use valueChangeListener and ofcourse don't forget the auto submit to be true, and once you submit a value, you can add it to the uploadedFile "files" list.
    The only problem you may have is that when a user try to update an existing uploaded file, I believe this may require tweaking so instead of having List<UploadedFile> you can have a Hashtabl<UIComponent,UploadedFile> to make sure you map things correctly!
    I'll try it and let you know the results
    Edited by: agawish on Mar 6, 2012 11:28 PM

  • Multiple file upload in jsp with out using �FILE� type filed.

    I have an applet that is used for multiple file selection, It allows drag and drop functionality also. The problem is once the user selects multiple files it has to get uploaded to the server. Since it�s not part of a file type component while submitting the form we won�t get the file contents.
    We can use multipart api for uploading files, but if the file selected by the user is not by the file type filed the file contents won�t come as part in the jsp submission and I can�t assign the file names selected by the user through the applet to any FILE (hidden ) type in jsp .
    Please give a solution�

    We can use multipart api for uploading files, but if the file selected by the user is not by the file type filed the file contents won&#146;t come as part in the jsp submission and I can&#146;t assign the file names selected by the user through the applet to any FILE (hidden ) type in jsp .Well i think thats a wrong notion which you have...
    you can very well get non-file type field data & file item data from a multipart form.
    Anyways,Letz checkout a simple example(refer to the below Code-snippet down below) which can do that task for us and it uses commons-fileupload & commons-io libraries.
    FileUpload.jsp
    ==========
    <form name="sampleForm" action="uploadAction" method="POST" enctype="multipart/form-data">
      File Name 1: <input type="text" name="fileName1" size="5" /> <br/>
      File: <input type="file" name="file1" id="file1" /> <br/>
      File Name 2: <input type="text" name="fileName2" size="5" /> <br/>
      File: <input type="file" name="file2" id="file2" /> <br/>
      File Name 3: <input type="text" name="fileName3" size="5" /> <br/>
      File: <input type="file" name="file3" id="file3"/> <br/>
      File Name 4: <input type="text" name="fileName4" size="5" /> <br/>
      File: <input type="file" name="file4" id="file4"/> <br/>
      <input type="submit" value="upload"/>
    </form>uploadAction method in (backingBean) :
    ==============================
    public void uploadAction(HttpServletRequest request,HttpServletResponse response)throws Exception{
          FileUploadUtils fuu = new FileUploadUtils(request);
          Map<String,FileItem> fileFields = fuu.getFileFiledsMap();
          Map<String,String> nonfileFields = fuu.getNonFileFiledsMap();
           String fileName1 =  nonfileFields.get("fileName1");
           FileItem file1 = fileFields.get("file1");       
           byte file1ContentBuffer[] = file1.get();
           String file1ContentType = file1.getContentType();
           InputStream file1ins = file1.getInputStream(); 
           file1.write(file1Name);
           String fileName2 =  nonfileFields.get("fileName2");
           FileItem file2 = fileFields.get("file2");
           byte file2ContentBuffer[] = file2.get();
           String file2ContentType = file2.getContentType();
           InputStream file2ins = file2.getInputStream();
           file2.write(file2Name);
    }FileUploadUtils.java:
    ===============
    import java.io.File;
    import java.io.FileOutputStream;
    import java.util.ArrayList;
    import java.util.Date;
    import java.util.Iterator;
    import java.util.List;
    import java.util.StringTokenizer;
    import java.util.Vector;
    import javax.servlet.http.HttpServletRequest;
    import org.apache.commons.fileupload.DiskFileUpload;
    import org.apache.commons.fileupload.FileItem;
    import com.gehcsr.utils.dao.DbQueryUtils;
    public class FileUploadUtils {
       private Map<String,FileItem> fileItemMap = null;
       private  Map<String,String> nFileItemMap = null;
       private HttpServletRequest request = null;
       public FileUploadUtils(HttpServletRequest request)throws Exception{
                   this.request = request;    
                   this.fileItemMap = new HashMap<String,FileItem>();
                   this.nFileItemMap = new HashMap<String,String>();
                   this.init();
       private void init() throws Exception{
          DiskFileUpload dfu  = null;
          List fileItems  = null;   
             try{
                   dfu = new DiskFileUpload();
                   dfu.setSizeMax(1000000);
                   dfu.setSizeThreshold(4096);
                   dfu.setRepositoryPath(System.getProperty(java.io.tmpdir));
                   fileItems = dfu.parseRequest(this.request);
                   if(dfu.isMultipartContent && fileItems != null){
                            Iterator iter =  fileItems.iterator();
                  while (iter.hasNext()) {
                       FileItem item = (FileItem) iter.next();           
                                  String fieldName = item.getFieldName(); 
                             if (!item.isFormField()){
                                              String fieldValue = item.toString();
                                               this.nFileItemMap.put(fieldName,fieldName); 
                                         }else
                                             this.fileItemMap.put(fieldName,item);                              
                    }catch(Exception exp){
                         exp.printStackTrace();
                         System.err.println(exp.getMessage());
                         throw new Exception(exp.getCause());
                    } finally{
                       fileItems = null;
                       dfu = null; 
             public  Map<String,FileItem>  getFileFiledsMap(){
                    return this.getFileFiledsMap;
             public Map<String,String> getNonFileFiledsMap(){
                   return this.nFileItemMap;
    NOTE:* Do not forget to add latest versions of commons-fileupload.jar & commons-io.jar in your classpath.You might get few warings due some issues with regards to generics please neglect them.
    and it is not certain that you ought to use commons libraries for this there are many other alternative solutions available by which you can implement a similar functionality.
    Hope this might help !!! if that does do not forget to assign/share duke dollars which you have promised :)
    REGARDS,
    RaHuL

  • Could not find multiple file upload in Jdeveloper 11.1.2.3

    Hi,
    I am using Jdeveloper 11.1.2.3, I am trying to use the multiple file upload feature but I could do not find (Rows) propriety in Input file component. so, what I am missing? is there some extra library need to be add to the application?

    Hi,
    its a feature of 12c
    Frank

  • Multiple file upload not working in IE10 and IE11

    Hi,
    As per the UI5 documentation( https://sapui5.hana.ondemand.com/sdk/#test-resources/sap/ui/commons/demokit/FileUploader.html) , UI5 supports multiple file uploading for IE10 and IE11. I set the "multiple: true" flag in the fileuploader example page and the file browser dialog is not allowing to select multiple files. Does UI5 provide multi file upload support for IE10 and IE11 or am i missing anything ?
    regards
    Raja

    Huh?
    Your problem makes no sense. The filename is included with the upload so that the server knows what the file was originally called. Are you running the JSP locally and reading the file directly off the hard drive??
    I note also that you aren't using a multipart form, which is required to upload a file.
    <form action="uploadFile.jsp" method="post" enctype="multipart/form-data">
      <input type="file" name="upload" value="<%= fileName %>" />
    </form>You'll need to use the Jakarta Commons FileUpload class to correctly process a form encoded with "multipart/form-data" or getParameter("xxx") will return null. You can also use the older com.oreilly.servlet.MultipartForm or whatever it's called. I'm pretty certain that the Jakarta Commons obsoletes all the COS classes.
    Brian

  • Multiple File Upload With Metadata Using REST

    hi all
    I want to upload multiple files with metadata to document library using REST API. I am using this msdn article
    http://msdn.microsoft.com/en-us/library/office/dn769086(v=office.15).aspx for uploading file. I am able to upload single file to document library but it is not working for multiple file. when I select multiple file it is uploading last selected file. can
    anyone help with this. I am using office 365 environment.
    Thanks in advance

    Hi,
    According to your post, my understanding is that you wanted to use the REST to upload multiple files.
    Per my knowledge, the REST API is not supported for uploading multiple files via a single call.
    You can write your own loop to upload multiple files via an individual call.
    http://sharepoint.stackexchange.com/questions/108525/multiple-file-upload-with-metadata-using-rest/108532#108532
    More reference:
    http://sharepointfieldnotes.blogspot.com/2014/04/uploading-documents-and-setting.html
    http://www.shillier.com/archive/2013/03/26/uploading-files-in-sharepoint-2013-using-csom-and-rest.aspx
    Thanks & Regards,
    Jason
    Jason Guo
    TechNet Community Support

  • Multiple File uploads Hotmail Style

    Hi all,
    I have been trying to do multiple file uploads in the hotmail style, i.e. to store all the filenames in a list one by one and uploading all files all at once. What I couldn't understand is the part on how hotmail stores each filename in a list and refreshes the page. I have tried doing a javascript->applet communication but it's just not the same. I apologize if this is not the right forum for this question. Can anyone please help me out? Thanks.

    Thanks but I am actually looking at doing some form of manipulation on the files in the list, i.e. get all the filenames from the list and produce outputs to be saved on the server and call the applet. Therefore, I will need to understand the minor details of how hotmail does it. I really appreciate your help anyway. Cheers. :)

  • Multiple File Upload Applet

    I am attempting to code a JavaBean wrapped by an applet that will upload multiple files to a web server via the multipart/form-data mime-type.
    I have moved a number of files to the web server with limited success.
    I cannot move more than roughly 30Mbs of files in any configuration without causing a fatal exception.
    I am confident that it is a limitation of the client's VM and the memory allocated to the applet.
    I have seen several commercial grade applets that claim they can move any number of files even totalling 180Mbs.
    My applet is very simple. It opens a JFileChooser dialog box, allowing the user to select multiple files and communicates directly to a server side component that accepts multipart/form-data.
    I am navigating the protocol just fine. It seems to be a memory problem on the client side. Does anyone know how I can defeat this restriction and pass a reasonably high number of files (100-200) ranging from 50Mbs to 180+Mbs?
    Secondly, why does this happen: when I put my files onto the output stream, no files move accros the stream until I call .close(). How can I write the code to begin transferring bytes as soon as I call outputstream.write(xxx)?

    i am also developing multiple file upload applet and i transferred 1,4gb of data (2 files a 700MB) successfully.
    also, i just transferred a few hundred files with total size of 900mb to my localhost webserver (~5000kb/s)
    1) open file
    2) read a few kilobytes into buffer
    3) send them to the server
    4) flush the outputstream (!!)
    5) clear buffer and goto 2)
    6) if end-of-file, close the file and flush again.
    the outputstream is flushed every few kilobytes, so it will be sent over the socket to the server and not buffered until dawn.
    i don't know how the server-side is working, but i used apache/php script.
    you can try out my applet under
    http://www.haller-systemservice.net/jupload/

  • Upload Friendly (Multiple File Upload Applet)

    Title : Upload Friendly (Multiple File Upload Applet)
    Description : UploadFriendly is an easy to use Java Applet that will allow multiple file
    uploads on a web server in a web page. The control supports file filtering, limits and more.
    Samples available in the following languages: ASP, ASP.NET, PHP, Coldfusion and JSP
    Link: http://www.uploadfriendly.com/
    Type: Commercial (30 days Trial)

    Hi shiil,
    To move the documents between site collection, content organizer rules would be a recommended method, you can activate Content Organizer features to enable content organizer rules on the site, to root the document to another site collection.
    Also, for this issue, as Prasath suggested, you can check out the document in the ItemAdded event, then add ItemCheckedout event, in the ItemCheckedout event, delete the document. Or as content organizer rule does, you can create your own timer job to move
    the document.
    More information, Content Organizer Feature Overview for SharePoint Server 2010 Developers (ECM):
    http://msdn.microsoft.com/en-us/library/office/ee558288(v=office.14).aspx
    Thanks,
    Qiao Wei
    TechNet Community Support

  • Is there a way to simultaneously add text to Comments field for multiple files?

    Is there a way to simultaneously add text to Comments field for multiple files? I know I can use Option+Comman+i to bring up the Inspector window but it doesn't have a Comments field. For example, in iTunes you can select multiple files and change metadata for any field simultaneously and easily yet when it comes to the Comments field in the Finder, this seems to be missing.
    In our production environment, Comments field is important because we place notes about what drive the file originated then when it gets transferred to LTO-6 tape via LTFS, we can quickly trace it in the event we needed to recreate the hard drive. Because tape archiving is linear, we can't store all of the files on the same tape.
    We've tried using Apple's Automator but it too seems to not have a way to batch change text in the Comments field. Any help is appreciated.

    What is "order data"?

  • The file size of selected file in input file control is shown as 0 for multiple file selection in Safari 5.1

    The file size of selected file in input file control is shown as 0 for multiple file selection in Safari 5.1. If you select single file, then it is able to return file size correctly. However, if you select multiple files, then the file size of each of the selected file is always returned as 0 from javascript. This works correctly in Safari 4.0 but it does not work in Safari 5.1.
    How do I get the correct file size in Safari 5.1 ?

    If you want to post (or send me) a link to the lrcat file, I'd take a look at it for you, and give you a break-down what's consuming all the bytes. But it might be fun to learn how to do that yourself (e.g. using SQL). I use SQLiteSpy, but other people have their favorites.. (or you can use a command-line client if you prefer..). One way: just run "drop table "{table-name}" on each table then look at filesize (do this to a copy, not the real thing).
    Anyway, it's hard to imagine keywords and captions etc. taking much of the space, since even if you had 1000 10-character words of text metadata per photo average that still only adds up to 117MB, which isn't a substantial portion of that 8G you're seeing occupied.
    Anyway, if you've painted the heck out of most of them and not cleared dev history, that'll do it - that's where I'd put my money too...
    One thing to consider to keep file-size down:
    ===================================
    * After reaching a milestone in your editing, take a snapshot then clear edit history, or the top part of it anyway (e.g. leave the import step), using a preset like:
    Clear Edit History.lrtemplate
    s = {
        id = "E36E8CB3-B52B-41AC-8FA9-1989FAFD5223",
        internalName = "No Edit",
        title = "Clear Edit History",
        type = "Develop",
        value = {
            settings = {
                NoEdit = true,
            uuid = "34402820-B470-4D5B-9369-0502F2176B7F",
        version = 0,
    (that's my most frequently used preset, by far ;-})
    PS - I've written a plugin called DevHistoryEditor, which can auto-consolidate steps and reduce catalog size - it's a bit cumbersome to use a.t.m. but in case you're interested...
    Rob

Maybe you are looking for

  • Open dictionary error from Persuasion 2.1

    First of all, I posted this last night, but I put it in the wrong forum, since it was not at all obvious that you had to click on the "Using your Mac (whatever)" in order to post a new question/issue. I think it might be helpful to have that link on

  • Error when activating update rules for R/3 training and event management

    hi all, when iam trying to activate update rules for training and event management cube it is giving fallowing error."IC=0PE_C01 IS=0HR_PE_1 error when checking the update rules Message no. RSAU461". please guide me how to solve this issue. thanks &

  • Structure in Graph view

    Hi I have created Structure in BI query with Restrictions & Selection. I want to show it in the graph but i am not able to see that when i select a graph. I can see if i use the table. But my user wants both table as well as graph, how do i configure

  • Park Post option in F-48 & F-53

    Hi My client has requirement in Payments (F-53) & Downpayments (F-48) that entry must be entered by someone else & it must be posted by someone else after verification. There is park & post option in FB60, FB70, etc. But there is not such parking & p

  • IOS 7 wont install on Ipad 2 even after Download was Completed in iTunes

    I just downloaded ios7 on my ipad 2 in iTunes. The download was completed. However, my iPad will not let me leave the setup page. It is telling me to " Connect to iTunes" and when I connect it wont do anything else. Ive backed up my ipad and set up i