1

I wanna do some thing like this: 1 - user insert a name 2 - after that i create a file white the user inserted name, and save file in user drive, like c drive. i need to do this using java script, but i have no idea about it, i saw some example about filesystem in Html5, but this approach, at the final, make u download the file, but i want to save this in a specified place by my self. can u give me some guide or some document about this filed? foe example i try this: http://www.noupe.com/design/html5-filesystem-api-create-files-store-locally-using-javascript-webkit.html but because i can't understood it.

123
  • 51
  • 1
  • 1
  • 8
  • http://jsfiddle.net/UselessCode/qm5AG/ like this way.. – sheshadri Apr 30 '15 at 07:30
  • You should check out this question. http://stackoverflow.com/questions/7160720/create-a-file-using-javascript-in-chrome-on-client-side – Mubashar Abbas Apr 30 '15 at 07:30
  • Don't think you can directly write to a folder on the user's computer. You can only prompt the browser to download a file which will go into the downloads folder 99% of the time. – Fester Apr 30 '15 at 07:37
  • tnk u both, but this links crest/talk about how to crate file and give it to user, i want crest file in a specified place, whit out make user download any thing, if I want say it in simple way, my user press some button and a file will be create in(for example) : C:\mytemp\a.txt @user3588674 @/mubashir-abbas – 123 Apr 30 '15 at 07:38
  • @123 what if there is no `C:`? What if someone decides to create a 100GB file in your `C:`? – php_nub_qq Apr 30 '15 at 07:52
  • @php_nub_qq it's just a test, and i will use this app for trusted pc. – 123 Apr 30 '15 at 07:55
  • @123 it doesn't matter what you're going to use it for, if you can use it others can use it. – php_nub_qq Apr 30 '15 at 07:56
  • @php_nub_qq i guess i gone have some hard talk white my professor. – 123 Apr 30 '15 at 07:59
  • using a downloader script like https://github.com/rndme/download , `download("hello world", "hello.txt");` – dandavis Apr 30 '15 at 08:19

2 Answers2

1

You can't access a user's file system. The best you can do is use localStorage for normal browsers or cookies.

php_nub_qq
  • 15,199
  • 21
  • 74
  • 144
  • u know, in my own, i accepted ur words and i believe them, but i was talking to my proff and he mentioned this, and told me u can create a file like this, and in this way, but he simply don't explain it. – 123 Apr 30 '15 at 07:42
  • 2
    @123 No, you can't. If you could then the web would be a complete anarchy (not that it kind of isn't already). – php_nub_qq Apr 30 '15 at 07:45
  • you can download files from JS, you just can't specify the folder they are created in. – dandavis Apr 30 '15 at 08:19
  • @dandavis yes, js let u create a temp file and give it to user, and then user must download the file. – 123 Apr 30 '15 at 08:39
  • perhaps your prog was meaning cookies? just a thought. Thank goodness JS cannot just write files to our system willy-nilly. – Jon Holland Apr 30 '15 at 09:21
  • @JonHolland no, no it's just a challenge between me and my professor :)) – 123 Apr 30 '15 at 09:54
  • Local storage then perhaps? [w3schools html 5 web storage](http://www.w3schools.com/html/html5_webstorage.asp). Although that is not really a file that the user can then open. Is your prof just trying to get rid of you for a couple of hours :) ? Just seen php_nub_qq suggested localStorage so upped his answer. – Jon Holland Apr 30 '15 at 11:21
0

OK, OK OK, tnk every body who came here and put there time to answer my question. finally after a week, yesterday, i went to have some talk with my professor, and he smiled at me, and say u can't find it, bcz js don't have this access and i just need to see my student research about some thing, some thing with false answer.

123
  • 51
  • 1
  • 1
  • 8