File Uploads
File upload
Remake can trigger a file upload using a single line of HTML.
<input update:profile-image type="file">
Displaying an uploaded file
To display the file after it's uploaded, you just need to add a couple more lines:
<div object key:profile-image="@search">
<input update:profile-image type="file">
<img target:profile-image="@attr:src" src="{{profileImage}}">
</div>
☝️ This is a complete file-upload application.
- If you added this to
app/pages/app-index.hbs
, you'd have an app where your users could upload and share a single file at a time.
What Remake does
Remake takes care of:
- Uploading the file to a user directory
- Showing the file's upload progress
- Sending the file's final path back to you
You just have to do two steps:
- Create the file
<input>
element - Tell Remake where to insert the file after it's done uploading
That's it! File uploading is finally easy! 🎉
View on GitHub