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

florimodo florimodo at gmx.de
Tue Oct 12 11:29:59 CEST 2010


Thanks for your help!
So I can map one file extension to only one content type!?
I my case, all content types do have the suffix "html", so if I would
like to map documents of content type "TypeA" I had to introduce a new
suffix like ".typea_html" or could I also create a mapping for
"typea.html"  so all documents with a name "*typea.html" (e.g.
"instance1_typea.html") would be mapped to that type.


Am 12.10.2010 10:49, schrieb Mario Jäger:
>
> 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.
>
>   




More information about the opencms-dev mailing list