c# - User to specify directory path -


i give users option select directory path on local machine (not select actual file).

this can save xml files directory on hard drive. when user selects directory want pass path code loads data xml files database.

i know can users select file:

<label for="file">filename:</label>             <input type="file" name="file" id="file" /> 

but not want, want them select directory.

can advise if done in mvc application.

a web application cannot directly write user's computer. best can provide downloadable link , user needs save as browser.

in case, forget directory path , give link/button on web page xml files.

on click, generate xml file database , use following snippet user download prompt.

// code on click of button/link  fileinfo file = new fileinfo(tempfilepathonserver);  response.clear(); response.clearheaders(); response.clearcontent(); response.addheader("content-disposition", "attachment; filename=\"" + file.name + "\""); response.addheader("content-length", file.length.tostring()); response.contenttype = "text/xml"; response.flush(); response.transmitfile(file.fullname); response.end(); 

Comments

Popular posts from this blog

apache - Remove .php and add trailing slash in url using htaccess not loading css -

javascript - jQuery show full size image on click -