Forum Discussion
tripp-bishop - Yes, you can add any custom code in your endpoint before the processing of image upload. You may create an Endpoint.
//Code to process XYZ things //Code to upload the image //Code to process XYZ things
VarunGrazitti Thanks! I'm running into an interesting issue:
Here's the content of my test endpoint:
<#assign status = "error" />
<#assign message = "no errors" />
<#assign upload_payload = http.request.parameters.name.get("image.content", "") />
<#compress>
<#attempt>
<#assign response = rest("/users/id/${user.id}/media/albums/default/public/images/upload?image.content=${upload_payload}") />
<#assign status = "success" />
<#recover>
<#assign message = .error />
</#attempt>
</#compress>
and this is the test form that is submitting to the EP:
<form method="post" action="/my-path/upload-test" enctype="multipart/form-data">
<input type="file" name="image.content"><br />
<input type="submit" value="Upload" /><br />
</form>
So super simple. What I'm seeing is that the line:
<#assign upload_payload = http.request.parameters.name.get("image.content", "") />
is setting the variable "upload_payload" to an empty string, probably because we failed to find a request param called "image.content". Is there another way I should be getting at the image.content variable that's being uploaded by the form?
Thanks for your help!
Cheers,
Tripp
Related Content
- 2 years ago
- 13 years ago