Reputation: 83
I have an app that is used in house only that uploads the same file from the same folder every morning. There is no chance that the file name or location will change.
Using #file name="" opens the folder where the file is located. That allows the user to select the file.
I need to "hard code the file path into the input so the same file is always uploaded.
Any suggestions?
Thanks
<input type="file" #file name="fileLocation" (change)="onFileChange($event)" />
Upvotes: 0
Views: 429
Reputation: 6646
From what ive read, it is impossible. Reading from disk without user input is not allowed in javascript.
look here
The only thing I can think of is to save the file in your assets folder , then load it using the file reader and append it to a FormData object. Overwise upload it to a file server, but that will defeat the purpose of uploading it everyday.
Upvotes: 1