Update of
/var/cvs/contributions/CMSContainer_Modules/fileupload/src/java/com/finalist/cmsc/fileupload/forms
In directory
james.mmbase.org:/tmp/cvs-serv10356/fileupload/src/java/com/finalist/cmsc/fileupload/forms
Modified Files:
UploadFileForm.java
Log Message:
CMSC-1074 - Transfer upload module from InContext to CMSc - Made allowedmeta
types as configurable property
See also:
http://cvs.mmbase.org/viewcvs/contributions/CMSContainer_Modules/fileupload/src/java/com/finalist/cmsc/fileupload/forms
See also: http://www.mmbase.org/jira/browse/CMSC-1074
Index: UploadFileForm.java
===================================================================
RCS file:
/var/cvs/contributions/CMSContainer_Modules/fileupload/src/java/com/finalist/cmsc/fileupload/forms/UploadFileForm.java,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -b -r1.1 -r1.2
--- UploadFileForm.java 29 Sep 2008 14:44:29 -0000 1.1
+++ UploadFileForm.java 1 Oct 2008 12:01:54 -0000 1.2
@@ -14,6 +14,8 @@
import org.apache.struts.action.ActionMessage;
import org.apache.struts.upload.FormFile;
+import com.finalist.cmsc.fileupload.Configuration;
+
/**
* Struts form-bean for the file upload.
*
@@ -21,10 +23,13 @@
*/
@SuppressWarnings("serial")
public class UploadFileForm extends ActionForm {
+
private static final Log log = LogFactory.getLog(UploadFileForm.class);
private String title;
+
private String description;
+
private FormFile file;
/** [EMAIL PROTECTED] */
@@ -35,7 +40,9 @@
String title = getTitle();
if (StringUtils.isBlank(title)) {
errors.add("title", new
ActionMessage("fileupload.upload.error.title.empty"));
- } else if (title != null && title.length() > 255) {
+ }
+ else
+ if (title != null && title.length() > 255) {
errors.add("title", new
ActionMessage("fileupload.upload.error.title.toolong"));
}
@@ -47,7 +54,9 @@
FormFile file = getFile();
if ((file == null) || (file.getFileSize() == 0)) {
errors.add("file", new
ActionMessage("fileupload.upload.error.file.empty"));
- } else if (!isValidFileType(file)) {
+ }
+ else
+ if (!isValidFileType(file)) {
errors.add("file", new
ActionMessage("fileupload.upload.error.file.invalidtype"));
}
@@ -55,7 +64,7 @@
}
private boolean isValidFileType(FormFile file) {
- List<String> allowedFileTypes = Arrays.asList("video/x-flv",
"video/mp4");
+ List<String> allowedFileTypes = Configuration.getAllowedMimeTypes();
List<String> allowedExtensions = Arrays.asList(".flv");
String contentType = file.getContentType();
log.debug("file contentType: " + contentType);
_______________________________________________
Cvs mailing list
[email protected]
http://lists.mmbase.org/mailman/listinfo/cvs