FileUpload Response does not contain the content type

1
0
-1

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.

1 answer

1
0
-1

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

Comments

Submitted by hiranthaucsc83 on Tue, 10/11/2016 - 11:14

Bonita 7.2.4

Submitted by hiranthaucsc83 on Tue, 10/11/2016 - 11:15

Is there any property or configuration that I need to check?

Submitted by contact_420 on Tue, 10/11/2016 - 11:29

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

Submitted by hiranthaucsc83 on Wed, 10/12/2016 - 02:56

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?

Submitted by contact_420 on Wed, 10/12/2016 - 08:37

I see 3 possibilities, but you probably won't like them:
1. Extend API to write your own implementation of FileUploadForm implementation
2. Recompile sources of Bonita 7.2.4 with the fix of standard implementation.
3. 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

Notifications