[opencms-dev] Help UPLOADING FILES via POST

M Butcher mbutcher at grcomputing.net
Mon Dec 15 19:05:02 CET 2003


What does the client code (presumably a form) look like?


Matt

Emilio wrote:
> Hi,
> 
> I'm programming a document manager with OpenCMS, and I'm having problems 
> using POST and files... When I call the action (in a different file) the 
> JSP thinks that there's no file to upload . This is the code I use:
> 
>    /String WORKING_PATH="/system/uploads/";
>    com.opencms.file.CmsObject cms_obj
>    =((com.opencms.flex.cache.CmsFlexRequest)request).getCmsObject();
>    com.opencms.file.CmsRequestContext reqContext =
>    cms_obj.getRequestContext();
>    com.opencms.core.CmsRequestHttpServlet req =
>    (com.opencms.core.CmsRequestHttpServlet)(reqContext.getRequest());
>    java.util.Enumeration files = req.getFileNames();
>    while(files.hasMoreElements()){
>        String this_filename = (String) files.nextElement();/
>    /    byte[] filecontent = req.getFile(this_filename);
>        cms_obj.createResource(WORKING_PATH, this_filename, "binary",
>    null, filecontent);
>    }
> 
>    /
> 
> I have made tests and I can confirm thar it never enter the "while" 
> part. Why is that?
> Thanks for advance....
> 
> _______________________________________________
> This mail is send to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://mail.opencms.org/mailman/listinfo/opencms-dev





More information about the opencms-dev mailing list