How can I set a size limit for files uploaded in A

2019-05-26 07:39发布

I think the title is pretty self-explanatory, now...

I have been looking for a way of limiting the size of files uploaded in Alfresco 4.2.c through Share. I'm surprised there isn't any mechanism provided out-of-the-box, looks to me a pretty basic feature.

After some investigation the only way I see to make it possible is by implementing custom policy or behavior, according to what's discussed here:

http://forums.alfresco.com/forum/developer-discussions/web-content-services/limit-file-upload-size-34d-10272011-1416

Do anybody knows any other (simpler) approaches?

EDIT:

As Andreas Steffan suggested, I tried the following in my share-config-custom.xml (limiting the upload size to 1MB, for instance):

<config evaluator="string-compare" condition="DocumentLibrary" replace="true">
    <!--
       File upload configuration
    -->
    <file-upload>
        <adobe-flash-enabled>false</adobe-flash-enabled>
        <in-memory-limit>262144000</in-memory-limit>
        <maximum-file-size-limit>1048576</maximum-file-size-limit>
    </file-upload>
</config>

Just in case, I also tried the same configuration without success in the out-of-the-box deployed share-documentlibrary-config.xml.

2条回答
Luminary・发光体
2楼-- · 2019-05-26 08:11

If you have a dynamic limit size, you add your script in upload.post.js and in client side you can test the limit size in dnd-upload.js

查看更多
Anthone
3楼-- · 2019-05-26 08:32

Assuming it is enough to enforce the size limit for uploads in share, following http://docs.alfresco.com/4.2/index.jsp?topic=%2Fcom.alfresco.enterprise.doc%2Fconcepts%2Fdev-extensions-share-module-dynamic-configuration.html should give you what you want.

Put the limits such as

<in-memory-limit>262144000</in-memory-limit>
<maximum-file-size-limit>0</maximum-file-size-limit>

in share-config-custom.xml and it should be good to go.

查看更多
登录 后发表回答