[opencms-dev] How to upload multiple files and set content/file type?

Mario Jäger m.jaeger at alkacon.com
Tue Oct 12 10:49:14 CEST 2010



Hi,

You upload a zip file into OpenCms with the selected checkbox "Unzip file". In this case, the resource types, which are created are mapped with the extensions of the files in the zip file. The mapping between
the extension and the resource type for the default resource types is configured in the WEB-INF/config/opencms-vfs.xml. For example, the extension ".html" is mapped with resource type "plain" per default:

...
<resourcetypes>
   ...
   <type class="org.opencms.file.types.CmsResourceTypePlain" name="plain" id="1">
     <mappings>
       ...
       <mapping suffix=".html" />
       ...

That means, that there are created resources of type "plain" for files with name "*.html" in a zip file.


For example, if you want, that there are created resources of type "photoalbum" for files with name "*.html" in a zip file, then you have to add the<mappings>  node for the module "org.opencms.frontend.photoalbum" in the
WEB-INF/config/opencms-modules.xml:

...
<module>
   <name>org.opencms.frontend.photoalbum</name>
   ...
   <resourcetypes>
     <type class="org.opencms.file.types.CmsResourceTypeXmlContent" name="photoalbum" id="55">
       <mappings>
         <mapping suffix=".html" />
       </mappings>
       ...

And you have to remove the mapping between the "*.html" files and the resource type "plain" in the WEB-INF/config/opencms-vfs.xml:

...
<type class="org.opencms.file.types.CmsResourceTypePlain" name="plain" id="1">
   <mappings>
     ...
     <!--<mapping suffix=".html" />-->
     ...


After that, you have to restart your servlet container.

-- 
Kind Regards,
Mario.

-------------------
Mario Jäger

Alkacon Software GmbH  - The OpenCms Experts
http://www.alkacon.com - http://www.opencms.org


Am 06.10.2010 16:42, schrieb florimodo:
> Hi, I have created xml files outside of OpenCMS and want to upload them
> using the workplace tool. Unfortunately I can only set the file type of
> the uploaded file if I upload a single file but not for zipped files. Is
> there any possibility to upload multiple files and set their file type
> in a batch mode using the workplace?
> Thanks in advance!
>
> _______________________________________________
> This mail is sent to you from the opencms-dev mailing list
> To change your list options, or to unsubscribe from the list, please visit
> http://lists.opencms.org/mailman/listinfo/opencms-dev



More information about the opencms-dev mailing list