0

I have a requirement where user will create a file first then I will start logging data into that file, How can i prompt window so user can browse to local directory and save file with their choice of location ?

Any angular way of implementing this ?

main.html

<button type="button" class="btn btn-success" ng-click="recordLogs()">record</button>

ctrl.js

$scope.recordLogs = function(){
        window.open("C:///");
    }
hussain
  • 6,587
  • 18
  • 79
  • 152
  • 1
    I am not sure you can gain access to the local file system as it would be considered a security risk (think of hackers making a user click on a button - hyperlink or image or whatever - and then it writes some file to their computer)... I could be wrong tho' – blurfus Jul 18 '16 at 20:41
  • Are you in the browser, or is this a desktop application running on something like Electron? If you're in the browser, you don't have any file system access. – TAGraves Jul 18 '16 at 20:43
  • Possible duplicate of [Read/write to file using jQuery](http://stackoverflow.com/questions/582268/read-write-to-file-using-jquery) – blurfus Jul 18 '16 at 20:43
  • its internal web application user has to go through authentication to access this url – hussain Jul 18 '16 at 20:43
  • Write file on server or use database – charlietfl Jul 18 '16 at 20:45
  • can you do the logging on the server side and when done, ask the client to download the file from the server? – blurfus Jul 18 '16 at 20:47
  • logging is already happening at server side , on client side user is seeing live logs where user will have option to record the logs, so for that i want user to save file first then i will start logging into that file. – hussain Jul 18 '16 at 20:48

1 Answers1

2

Not possible, The client does not have access to the file system. You could however do something like this on the server and then output the files as downloads to the client.

If the application is internal then maybe the server/farm it lives in has network access to the users system in which case you could save and update the files accordingly over ssh etc.

The users system will need to have known credentials for access, Active Directory, system admin account, etc.

Justin Herter
  • 590
  • 4
  • 17