I am using the “File Upload” widget to attach some files along with my process instance.
According to the criteria, I need to allow only JPG, PNG, GIF, and PDF types. For that, I need to do the validation in client side based on the response from the server once you attach a file. I am expecting it to return the content type. But I am not getting it.
JSON response looks like below;
{
tempPath:“tmp_7163506731985010868.jpg”
filename:“Hydrangeas.jpg”
}
Do you have any idea? How can I fix this?
I saw, sample “FileUpload” project , it uses the same logic.
What version of Bonita do you use?
I use 7.3.1 and there is contentType in the return object, for example:
{filename: “logo.png”, tempPath: “tmp_7770943597331024898.png”, contentType: “image/png”}
Best regards,
bpms.help
Is there any property or configuration that I need to check?
There was an issue with contentType (see repository ).
And it was fixed in 7.3.0 version, so update is the best option.
Best regards,
bpms.help
Thanks for info.
But, Updating the Bonita is not the easiest solution now. Because there are some running applications in Live env with 7.2.4 version.
Any other suggestions?
I see 3 possibilities, but you probably won’t like them:
- Extend API to write your own implementation of FileUploadForm implementation
- Recompile sources of Bonita 7.2.4 with the fix of standard implementation.
- If you can assume that users doesn’t use IE9 or older, than you can easily chech contentType directly in JavaScript (using JavaScript FileReader API)
Best regards,
bpms.help