[opencms-dev] Help UPLOADING FILES via POST

Emilio escoembulma at terra.es
Mon Dec 15 16:16:01 CET 2003


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....




More information about the opencms-dev mailing list