[opencms-dev] Unable to get File contents while Upload

Mohit Raj mohit.raj at amsoft.net
Wed Jan 12 12:45:44 CET 2005


Hi,

I am uploading  a file from a HTML page using the input tye=file. Form is
submitted to a jsp file. 
Now, how can I read the contents of the uploaded file into a byte array. I
tried using:

String fileName = (String) files.nextElement();
byte[] filecontent = (byte[])
cms.getRequestContext().getRequest().getFile(fileName);
......
.....
CmsResource res =  cms.createResource("/system/modules/mohit/Upload2/",
uploadedFileName, "jsp", props, filecontent);
  

This gives an error:

Root cause:
org.apache.jasper.JasperException
	at
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:3
72)
	at
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:292)....
...
................................
.............

It seems filecontent doesnt get the byte[]. createResource method has been
checked without filecontent parameter and it works fine. Any ideas why its
not working????

Thanks,
Mohit


-------------- next part --------------
A non-text attachment was scrubbed...
Name: winmail.dat
Type: application/ms-tnef
Size: 2028 bytes
Desc: not available
URL: <https://webmail.opencms.org/pipermail/opencms-dev/attachments/20050112/1303cc6d/attachment.bin>


More information about the opencms-dev mailing list