asp.net mvc - SaveFile Dialog for MVC in razor/bootstrap -


am using openxml open, modify save docx document. code (not shown) open document, modify , can save directly direct path. cannot find how make user save file dialog work? the type or namespace name 'savefiledialog' not found (are missing using directive or assembly reference?)

    savefiledialog savefiledialog1 = new savefiledialog();      savefiledialog1.filter = "txt files (*.txt)|*.txt|all files (*.*)|*.*";     savefiledialog1.filterindex = 2;     savefiledialog1.restoredirectory = true;      if (savefiledialog1.showdialog() == dialogresult.ok)     {      response.clear();              response.contenttype = "application/octet-stream";              string filenamewrite =(string) (session["filenamefromuser"]);              response.addheader("content-disposition",    string.format("attachment; filename={0}",filenameout));              response.binarywrite(mem.toarray());              response.flush();              response.end(); 

the savefiledialog kind of method hoped use cannot find such similar method.

even tried install bootstrap dialog nice graphics? http://getbootstrap.com/javascript/#modals worked few times, after modifying fit code, button clicking did nothing. went original , pasted in, saved, still nothing anymore.

the controller has modified byte array, @ response.clear(); end, part runs , saves file, has user dialog save file interface returns literal string path user?

is there similar kind of method savefiledialog mvc controller can see?

edit: browser setting preventing dialog box, save /downloads folder without prompting. secret in 1 of response header or content settings browser automatically generate savefileas dialog. in winforms done manually... method works, although may have redundancy:

    public filecontentresult getfile(byte[] m)     {         string mimetype = "application/vnd.openxmlformats-officedocument.wordprocessingml.document";         string filenam = "output.docx";         byte[] filecontent = null;         filecontent = m; //["filecontent"];         ///////////////////////////         response.clear();         fileinfo file = new fileinfo(filenameout);         response.addheader("content-disposition", "attachment; filename=" + file.name);         response.addheader("content-length", file.length.tostring());         response.contenttype = "application/octet-stream";         response.transmitfile(file.fullname);          // string filenamewrite = (string)(session["filenamefromuser"]);         // response.addheader("content-disposition", string.format("attachment; filename={0}", filenameout));          response.flush();         response.end();         return file(filecontent, mimetype, filenam); //pass contents bytes[] , mimetype , , file name save as.      } 

savefiledialog windows native app thing , not web app thing.

simply put... cannot force user see save dialog depends on browser , settings have in browser see.

content-disposition suggests default filename if user chooses save file! browser uses content-type header determine do.


Comments

Popular posts from this blog

javascript - Using jquery append to add option values into a select element not working -

Android soft keyboard reverts to default keyboard on orientation change -

jquery - javascript onscroll fade same class but with different div -