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

[FR] Ability to post base64 images #4989

Open
JustJarethB opened this issue Sep 25, 2019 · 3 comments

Comments

@JustJarethB
Copy link

commented Sep 25, 2019

Description

Sometimes we want to upload an image without using input type="file". Base64 encoding is a reasonably common format and can be set as an input's value without much trouble.

@andris-sevcenko

This comment has been minimized.

Copy link
Member

commented Sep 25, 2019

This has been possible for quite a while now.

If memory serves you would use the following code in your templates.:

<input type="text" name="fields[assetFieldHandle][data][]" value="data:image/jpeg;base64,<BASE64DATA>" />
<input type="text" name="fields[assetFieldHandle][filename][]" value="filename.jpg" />
@JustJarethB

This comment has been minimized.

Copy link
Author

commented Sep 26, 2019

Amazing, thanks @andris-sevcenko. I didn't find this anywhere in the docs though, would it be possible to make it more easy to find this out? Perhaps add to https://docs.craftcms.com/v3/assets-fields.html#uploading-files-from-front-end-entry-forms ?

@andris-sevcenko

This comment has been minimized.

Copy link
Member

commented Sep 26, 2019

Fair point!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants
You can’t perform that action at this time.