Search code examples
phpjavascriptfwrite

Need a solution similar to 'Save as' dialog box to choose the file name and location using javascript?


I need to use fwrite function in php for storing a file at a location, chosen by user. I am just curious, if there is any way such that I can show some thing similar to 'save as' dialog box in javascript to choose the file name and the location to be saved, so that I can send this name to php and use it as argument to fwrite function.

Thanks in advance.


Solution

  • You can use Ajax to create something like that: Open a dialog, call php scandir to get directory structure, return it and draw in your dialog. Finally upload the file when user select a path.

    You can DIY, or using a free 3rd party plugin like this http://ckfinder.com/demo