cancel
Showing results for 
Search instead for 
Did you mean: 

Access uploaded file in Groovy Script

jvaidya
Confirmed Champ
Confirmed Champ

I'm trying to Base64 encode a file that a user uploads in an Activiti form, and then save the resulting encoding as a string to be accessed by other parts of the business process. I thought a Groovy Script in a Script task would be the best way to do this. How do I access the file in the script? 

Would something like: 

execution.getVariable('file'); 

give me access to the raw file? 

Thanks!

1 ACCEPTED ANSWER

Managed to solve this issue! We had to change the activiti-app.properties configuration file to set:

# Beans whitelisting
beans.whitelisting.enabled=false

# EL whitelisting
el.whitelisting.enabled=false

View answer in original post

13 REPLIES 13

Thanks so much that's really helpful! Unfortunately, I'm getting this error: 

problem evaluating script: javax.script.ScriptException: groovy.lang.MissingPropertyException: No such property: relatedContentService for class: Script1

Any thoughts? 

gdharley
Elite Collaborator
Elite Collaborator

No idea, I built this just now in my 1.6.1 environment and it runs ok (Process Services 1.6.1 on Tomcat).

Managed to solve this issue! We had to change the activiti-app.properties configuration file to set:

# Beans whitelisting
beans.whitelisting.enabled=false

# EL whitelisting
el.whitelisting.enabled=false

gdharley
Elite Collaborator
Elite Collaborator

Ahh yes, Alfresco in their infinite wisdom decided to lock down security by disabling access to beans without telling anyone in 1.6.

Should have thought of that.

Greg

#bp3