6

chrome's access to local files are restricted, but I would like to draw an image on a canvas: an image selected with a file input and without sending the image to the server and then requesting it back.

Some help would be great!

  • Is your HTML file also local, or are you asking the user to go to your website, select a file from disk, and then have JavaScript access to that file without ever sending it to your server? – Phrogz Jan 21 '11 at 17:45
  • Second answer. The purpose is to make modifications on the image, and upload to the server seems to be time consuming. –  Jan 21 '11 at 20:11

2 Answers2

3

Since your using Google Chrome, file:// URIs cannot read other file:// URIs. If you are using this for development, then you can add the following command line switch to chrome:

--allow-file-access-from-files

HTML5 has (currently in development) FileSystem API you can read an example from it here: http://www.html5rocks.com/tutorials/file/filesystem/

Mohamed Mansour
  • 39,445
  • 10
  • 116
  • 90
0

If your file is not on the local domain, see this answer.

Community
  • 1
  • 1
Phrogz
  • 296,393
  • 112
  • 651
  • 745