0

I searched for way to download images by URLs and get there local path.

For example :

If my URL is: https://static.pexels.com/photos/207171/pexels-photo-207171.jpeg

I want to download this image and get its path such as this: file///...../*.jpeg

Ali H
  • 903
  • 14
  • 36
  • Short answer: no you can't do it in browser – Farnabaz Oct 19 '17 at 21:08
  • You can **detect** when an image is downloaded client-side - https://stackoverflow.com/questions/1106377/detect-when-browser-receives-file-download, but you would need either NodeJS or another server-side language to actually initiate the download (and check the download location). – Obsidian Age Oct 19 '17 at 21:10

1 Answers1

0

Unfortunatley (or luckily) you cannot access the file system from client-side JavaScript as the browser executes it. This is for security reasons.

The only way to access a file from the browser is the HTML file-input <input type="file" />.

To access the file system with JavaScript, you would need to use NodeJS and its fs-API.

Rico Herwig
  • 1,672
  • 14
  • 23