0

I need to read a local file and post it to the server, we do not need to choose the file. The path of the file is given.

uploading a file when user manually selects works but in the above scenario we need to read an existing file and post it.

1 Answers1

-2

I generally just require the file and upload it.

var file = require('path');
Kaan
  • 86
  • 4
  • This won't work. Javascript in a browser does not have arbitrary access to the local files system. See post linked to in my previous comment for why. – gforce301 Apr 17 '17 at 16:05
  • Oh okay sorry then, I use javascript with react and include files in this way. So different context – Kaan Apr 17 '17 at 16:17