javascript - Select Directory ASP.NET MVC-5 -


part of requirements user needs able export html table (populated via controller) excel. can create .csv , export it. need able let them select directory.

html5 answer:

   <input type="file">  

however not let select directory, specific file.

javascript:

everywhere read, big security threat. although there hacks don't want use that.

i tried make call folderbrowserdialog controller when hit function missing assemblies reference , cannot find correct one.

my question: if had let user select directoy, file exported to, in asp.net mvc5 project how it? html5, javascript/jquery, c# doesn't matter me. no security threats!

thanks guys

you have set 'content-disposition' header 'attachment' when generating file. cause normal browser save dialog pop , can navigate , save wherever want.

so in actionmethod, i'm assuming doing like: ... create csv ... return file(csvdata, "text/csv");

that method has overload accepts default filename. if set filename, automatically add content-disposition header , cause file downloaded instead of opened.

return file(csvdata, "text/csv", "somefile.csv");


Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -