From: mh Date: Mon, 8 Apr 2002 23:44:00 +0000 (+0000) Subject: added support for configuration of max size of a single upload and the maximum number... X-Git-Tag: prexmlproducerconfig~128 X-Git-Url: http://erislabs.org.uk/gitweb/?a=commitdiff_plain;h=f914ee974101010717340d0b649328c4b6be296b;p=mir.git added support for configuration of max size of a single upload and the maximum number of uploaded items at once --- diff --git a/bundles/admin_de.properties b/bundles/admin_de.properties index 43b898f0..e948ae08 100755 --- a/bundles/admin_de.properties +++ b/bundles/admin_de.properties @@ -334,7 +334,7 @@ open.posting.meta.author=IMC Kollektiv open.posting.meta.keywords=Freie Medien, Gegenöffentlichkeit open.posting.jump_to_form=Direkt zum Eingabeformular springen open.posting.title=Veröffentliche Deinen Beitrag -open.posting.nr_of_media=Anzahl der Medien +open.posting.nr_of_media=Anzahl der Medien (max 20) open.posting.nr_of_media.info=(wenn Du mehr als eine Datei hochladen willst, bitte hier die Anzahl eintragen und den Knopf drücken, bevor Du weitere Felder ausfüllst.) open.posting.nr_of_media.submit=Anzahl festlegen open.posting.form.title=Veröffentlichungsformular diff --git a/bundles/admin_en.properties b/bundles/admin_en.properties index d5eaad15..17c25cd5 100755 --- a/bundles/admin_en.properties +++ b/bundles/admin_en.properties @@ -331,7 +331,7 @@ open.posting.meta.author=IMC Kollektiv open.posting.meta.keywords=Freie Medien, Gegenöffentlichkeit open.posting.jump_to_form=Jump dirctly to the form. open.posting.title=Publish your article! -open.posting.nr_of_media=Number of Media Items +open.posting.nr_of_media=Number of Media Items (max 20) open.posting.nr_of_media.info=(wenn Du mehr als eine Datei hochladen willst, bitte hier die Anzahl eintragen und den Knopf drücken, bevor Du weitere Felder ausfüllst.) open.posting.nr_of_media.submit=Anzahl festlegen open.posting.form.title=Publishing Form diff --git a/source/config.properties-dist b/source/config.properties-dist index a778ea1a..733a6113 100755 --- a/source/config.properties-dist +++ b/source/config.properties-dist @@ -48,7 +48,11 @@ GeneratePDF=yes Rsync=no Rsync.Script.Path=/var/www/bin/rsync-copy +# the maximum allowed size of an uploaded media file in KB. +MaxMediaUploadSize=20000 +# the maximum number of allowed media items to upload at once. +ServletModule.OpenIndy.MaxMediaUploadItems=20 # # diff --git a/source/mir/misc/WebdbMultipartRequest.java b/source/mir/misc/WebdbMultipartRequest.java index cc999138..5b1871fa 100755 --- a/source/mir/misc/WebdbMultipartRequest.java +++ b/source/mir/misc/WebdbMultipartRequest.java @@ -26,7 +26,8 @@ public class WebdbMultipartRequest public WebdbMultipartRequest(HttpServletRequest theReq) throws IOException { req=theReq; - mp = new MultipartParser(req, 1024*20480); // maximum eight megabyte + int maxSize = Integer.parseInt(MirConfig.getProp("MaxMediaUploadSize")); + mp = new MultipartParser(req, 1024*maxSize); requestList = new ArrayList(); _evaluateRequest(); } @@ -121,5 +122,5 @@ public class WebdbMultipartRequest } } // while */ } - + } diff --git a/source/mircoders/servlet/ServletModuleOpenIndy.java b/source/mircoders/servlet/ServletModuleOpenIndy.java index 6483ef45..c4035bd0 100755 --- a/source/mircoders/servlet/ServletModuleOpenIndy.java +++ b/source/mircoders/servlet/ServletModuleOpenIndy.java @@ -147,9 +147,12 @@ public class ServletModuleOpenIndy extends ServletModule public void addposting(HttpServletRequest req, HttpServletResponse res) throws ServletModuleException { SimpleHash mergeData = new SimpleHash(); + String maxMedia = MirConfig.getProp("ServletModule.OpenIndy.MaxMediaUploadItems"); String numOfMedia = req.getParameter("medianum"); if(numOfMedia==null||numOfMedia.equals("")){ numOfMedia="1"; + } else if(Integer.parseInt(numOfMedia) > Integer.parseInt(maxMedia)) { + numOfMedia = maxMedia; } int mediaNum = Integer.parseInt(numOfMedia);