Local path to file #368
Reference in New Issue
Block a user
Delete Branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Hi there,
is there any property where is saved local path to file before upload, or any other way how I can get this path
thank you
I'm not 100% sure that you can get the full local path at least not on chrome.
However, if you're just looking to show a preview of the selected image before you upload it you can simply use FileReader, example:
component.ts
view.html
don't forget
import { ElementRef } from '@angular/core'Let me know if this helps :)
This code works great. To anyone copy and pasting this code, make sure to remove the p.image_url (set [src]="") or else you will get this pesky error in your console:
ERROR TypeError: Cannot read property 'image_url' of undefinedHi,
I also need the local path.
With IpaliboWhyte solution we can get only the base64 for images.
lets say I need to show the local path to the user to confirm upload:
https://stackoverflow.com/questions/15201071/how-to-get-full-path-of-selected-file-on-change-of-input-type-file-using-jav