-
Notifications
You must be signed in to change notification settings - Fork 149
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
Pass binary to cast_attachments
#54
Comments
I am doing the same in my project. Version @stavro Is there a way to do this now? |
I agree, this would be a nice feature to have. I can try to make a PR if you'd like, @stavro. @darkbaby123 @philipgiuliani A workaround you can use for now is to write the data out to a temp file and pass that temp file's path in. |
arc allows storing `%{filename: filename, binary: data}`, and now arc_ecto allows these structs to be accepted in `cast_attachments` fixes stavro#54
arc allows storing `%{filename: filename, binary: data}`, and now arc_ecto allows these structs to be accepted in `cast_attachments` fixes stavro#54
Hi, im using v0.7.0 and still could not pass binary data to cast_attachments. Was this ever solved? Also I tried using Plug.Upload by creating a temp file but it seems it works at times and does not work the other times. Can someone help me out here. My function that converts my base64 to Plug.Upload is as follow |
arc allows storing `%{filename: filename, binary: data}`, and now arc_ecto allows these structs to be accepted in `cast_attachments` fixes stavro#54
So as a workaround, you can pass: %{
__struct__: Plug.Upload,
binary: bytes,
filename: "filename.txt"
} In place of an actual |
arc allows storing `%{filename: filename, binary: data}`, and now arc_ecto allows these structs to be accepted in `cast_attachments` fixes stavro#54
There's a referenced issue in arc but I think it's arc_ecto's responsibility so I create an issue here.
My requirement is uploading file as base64 encoded string to the server. It's common for small files and is easy to work with JSON API. After googling I found arc support binary, so I thought I can decode base64 to binary and save the file.
arc support passing binary like this
Avatar.store(%{filename: "file.png", binary: binary})
but there's no way to pass binary in arc_ecto, Thecast_attachments(%{filename: "file.png", binary: binary})
fails. I checked the source and it seems the arc_ecto only supportPlug.Upload
struct. Is there a way or workaround to achieve this?The text was updated successfully, but these errors were encountered: