How can i validate the type and size of a file when i am using the ProjXUtil.uploadFile function?
ProjXUtil.uploadFile(this, new Var(mdbDokumente, "FILENAME"), new Var(mdbDokumente, "FILE_"));
More parameters in over the function uploadFile for filetype and size are not possible to set
I don't use a utility, instead with following snippet:
UploadButton butUpload = new UploadButton();
butUpload.eventAction().addListener(this, "doUpload");
public void doUpload(UIActionEvent pEvent) throws Throwable
{
IFileHandle fhandle = ((UploadButton)pEvent.getSource()).getFileHandle();
if (book.getSelectedRow() >= 0)
{
String sFormat = FileUtil.getExtension(fhandle.getFileName().toLowerCase());
if ("png".equals(sFormat) || "jpg".equals(sFormat))
{
InputStream stream = fhandle.getInputStream();
...
book.setValue("IMAGE", stream.toByteArray());
}
}
}