Posts

Showing posts with the label access local file path in ionic 4

How to access local file path in ionic 4

Image
Add Image Using Local File Path in ionic 4 Currently, the Ionic 4 version has lots of changes to access the file, you can't access the local file directly.  you need to follow current changes Webview  and also add Domsanitizer helps to prevent Cross-Site Scripting bugs. Common Problem observing that user use camera method to access the local file in ionic - It returns three types of destination   1. DATA_URL 2. FILE_URI 3. NATIVE_URI I recommend using FILE_URI to get the image path. After getting Image Let's Follow My Step. 1.  import two modules in component or page (e.g image-modal.component.ts) import { DomSanitizer } from '@angular/platform-browser'; import { WebView } from '@ionic-native/ionic-webview/ngx'; Now Assign Webview & DomSanitizer in the component constructor. constructor(private sanitizer: DomSanitizer, public webview: WebView){ console.log("constructor gitsof.com")} Add Im...