When using b-form-file to upload an image, is it possible to preview the image prior to uploading it?
See original GitHub issueI’m making an ‘avatar upload’ using b-form-file
and would like to show a preview of the selected image before it’s sent to the server.
https://stackoverflow.com/questions/4459379/preview-an-image-before-it-is-uploaded provides some possible answers but I was hoping there may be an easier way, perhaps this functionality is already baked-in but I couldn’t find a mention of it in the docs
Issue Analytics
- State:
- Created 4 years ago
- Comments:5 (2 by maintainers)
Top Results From Across the Web
Upload files in ASP.NET Core - Microsoft Learn
Files uploaded using the IFormFile technique are buffered in memory or on disk on the server before processing. Inside the action method, ...
Read more >Determine if uploaded file is image (any format) on MVC
In case it can helps anyone, Here is a static method for HttpPostedFileBase that checks if a given uploaded file is an image:...
Read more >Uploading a File using IFormFile Should Show an ... - GitHub
I am using IFormFile in the following action method to upload a file to my API. This causes the Swagger UI to display...
Read more >File Upload in ASP.NET Core 6 - Detailed Guide
In this article, let's learn about how to perform file upload in ASP.NET Core 6. The file for upload can be of any...
Read more >File Upload in ASP.NET Core MVC - Code Maze
In this article we are going to learn how to upload a file or multiple files in ASP.NET Core MVC application.
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
@vesper8 This example should help you out: https://codesandbox.io/s/bootstrapvue-image-preview-before-upload-xgj8s
@vesper8 Note you might have issues with really large images and some browsers which have a limit on the length of a data URI in the
<img>
src
attribute.But basically you can use the same method @jackmu95 provided to read the image file, but then pass the image to a
<canvas>
to process the file and scale it down in dimensions to get a “thumbnail” image as a data URI.