Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handling images via the APi #47

Open
jbardnz opened this issue Jun 29, 2015 · 1 comment
Open

Handling images via the APi #47

jbardnz opened this issue Jun 29, 2015 · 1 comment
Labels

Comments

@jbardnz
Copy link

jbardnz commented Jun 29, 2015

Hi

I am trying to handle images via your API. I can read the API fine and get a URL to the image but trying to create a new image via a POST request doesn't seem possible?
I have my image in base64 format but not sure how to post this to the API?

I assume this isn't built in behaviour so I need to upload it via a custom ACL method? Do you have an example for how I create a custom method?

Thanks

@colymba
Copy link
Owner

colymba commented Jun 29, 2015

It isn't built in at the minute... there is a plan for something like this to be included but not sure of the best way yet...

For now you got 2 options:

  • Create a new route to a special controller like upload: UploadController, which will handle the file upload and return a File ID.
  • Or use the new onBeforeDeserialize or onAfterDeserialize hooks, to catch your Base64 encoded file. So you could have your Base64 data in a json key like "rawFile": "018dar...", in the onAfterDeserialize grab the Base64 data and create a File, then remove the rawFile key and add a FileID to the deserialized payload

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants