问题
I'm creating a website that generates a text file. I would like for the user to save the file to a specific folder (it's a backup file for a video game).
Is it possible to change the default folder the file is saved to via PHP or HTML? C#, while not my first pick, would also be acceptable.
回答1:
If I understand correctly, NO you cannot default to a location on the users computer. This is just a security piece that you cannot get around.
Try educating the user before they download. That's the best way.
回答2:
No file download locations are handle at the browser level
回答3:
You could probably package the text file in an installer / extractor that loads it to the location you want, but I don't think you want to go that far ^.^
回答4:
You cannot prompt the user to save the file to a specific place on his/her computer, you can however save some stuff on the users pc by the use of Web Storage, that is a part of the HTML5 spec. You will not be able to control where it will be saved though.
It would not be a smart move to store backups for your game on the users pc, as it would open a endless world of cheating and hacking.
来源:https://stackoverflow.com/questions/8405180/prompt-user-to-save-file-to-a-specific-location