This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal



Aug 26, 2011, 6:03 PM
21 Posts
topic has been resolvedResolved

Requestmap does not contain com.ibm.xsp.http.UploadedFile object?

  • Category: APIs
  • Platform: Windows
  • Release: 8.5.2
  • Role: Developer
  • Tags:
  • Replies: 1
Hello,
 
I'm currently a bit playing around with the xpages api and I added a custom upload control to the page ( just by adding the html to the xpage , no xpage upload control ). In the onclick event of the submit  button I print the content of my requestmap ( param constant variable) And I noticed a key named the value of my custom upload field and the value of this is something similar to : 
 
"com.ibm.xsp.http.UploadedFile@2ff02ff0"
 
when I then print the class of this value I receive a String?? Can someone explain to me why this happens and how I can actually get a handle to the uploadedfile object???
Sep 7, 2011, 11:16 AM
21 Posts
Re: Requestmap does not contain com.ibm.xsp.http.UploadedFile object?
I have found the answer to my problem in another post on this forum:
 
 
I had a similar problem a while back and got a handle on the UploadedFile Object by doing this:
 
public void uploadFile(String serverid) {
        try {          
                String clientid = (String)FacesContext.getCurrentInstance().getApplication().getVariableResolver().resolveVariable(FacesContext.getCurrentInstance(), "#{id:"+serverid+"}");
                HttpServletRequest hsr = (HttpServletRequest)FacesContext.getCurrentInstance().getExternalContext().getRequest();
                Map map = hsr.getParameterMap();
                UploadedFile uf = ((UploadedFile)map.get(clientid));
                File fi = uf.getServerFile();
                // Do whatever you want with the file

            }
               catch (Exception e) {
                   System.out.println(e);
               }
        }

This forum is closed to new posts and responses. Individual names altered for privacy purposes. The information contained in this website is provided for informational purposes only and should not be construed as a forum for customer support requests. Any customer support requests should be directed to the official HCL customer support channels below:

HCL Software Customer Support Portal for U.S. Federal Government clients
HCL Software Customer Support Portal