0

I need to upload a single specific file (Ex. "C:\test.jpeg") to the web server using HTML5 components "FileAPI" and "XMLHttpRequest". Is it possible?

I have seen all types of examples that include drag and drop options, but I need less than that. I just need to call the JavaScript function, and I will send the path of the file I need to upload to a specific folder on the server.

IMPORTANT: I CAN NOT USE THE INPUT TAG. IT MUST BE DYNAMICALLY

Thanks in advance.

Aerofan
  • 119
  • 2
  • 5
  • If the user selects a file using the input tag, would that not send a path to the JavaScript function? That's kind of what I am looking for. – Aerofan Apr 22 '13 at 02:06
  • I am working with a scanner that saves images to a local folder on the computer. This scanners API works with JavaScript. While its running, I know the path were the images will be stored. But I need to save the image on the Web Server. Any hints on how to do this? – Aerofan Apr 22 '13 at 02:26
  • Why do you need to do this from a browser? – Ray Nicholus Apr 22 '13 at 02:35
  • you could make browser extesion to acheive the result. – zb' Apr 22 '13 at 09:45
  • @RayNicholus [why not ?](https://developer.mozilla.org/en-US/docs/Code_snippets/File_I_O?redirectlocale=en-US&redirectslug=Code_snippets%252FFile_I%252FO) – zb' Apr 22 '13 at 13:03
  • @eicto I already explained this in my answer. – Ray Nicholus Apr 22 '13 at 13:10
  • @RayNicholus you explained simple file api, I telling you about extesions, which even can control a big iron robothand on your yard if you write a driver and extension. – zb' Apr 22 '13 at 13:37
  • @eicto No, I didn't explain the File API. I discussed the Filesystem API. The poster asked how this can be done with HTML5. It can't. If you think it can, please provide some references or code. If you are referring to Flash or Java solutions, please note that this is not what the OP has asked for. – Ray Nicholus Apr 22 '13 at 13:43
  • @RayNicholus I already give [the link](https://developer.mozilla.org/en-US/docs/Code_snippets/File_I_O?redirectlocale=en-US&redirectslug=Code_snippets%252FFile_I%252FO) here other one https://developer.mozilla.org/en-US/docs/XPCOM I just tell about extensions because it is other way to get the result – zb' Apr 22 '13 at 13:44

1 Answers1

2

You cannot have arbitrary access to the filesystem from the browser, even with HTML5's Filesystem API. This has been discussed in many other threads on Stackoverflow. Have a look at one of the more recent threads, for example: Some questions about HTML5 FileSystemAPI.

Community
  • 1
  • 1
Ray Nicholus
  • 19,538
  • 14
  • 59
  • 82