razorengine - Download files from folder in webmatrix -
i have "ticket system" , when user creates ticket there option upload files. files go folder have name of ticket.
this code creates folder when ticket created.
var nomepasta = "ticket id - " + idnovopedido; string salva = path.combine(server.mappath("~/"),"uploadedfiles",nomepasta); directory.createdirectory(salva);
then on backoffice can see if there files on folder.
code check if there files:
@foreach (string fullfilepath in directory.getfiles(path.combine(server.mappath("~/uploadedfiles"),"ticket id - "+@id))) { <div class="linkficheiros"> <a href="@href("~/uploadedfiles","ticket id - "+@id,path.getfilename(fullfilepath))">@path.getfilename(fullfilepath)</a> </div> }
now question is, how can download files?
if click on link (example if it's photo, browser opens new window , show me image) , if it's "docx" says "the page cannot found."
update:
so i've found something, if file ".xls" can download without problem, if file ".docx" gives error mentioned above "the page cannot found.".
any thoughts ?
there other warnings in internet same problem stating depends on lack of definition on web server docx files' mime type : page cannot found error when executing hyperlink docx file.
anyway, if useful, in article have used universal routine file downloading: downloading files c#. should add .docx
case , mime type:
application/vnd.openxmlformats-officedocument.wordprocessingml.document
Comments
Post a Comment