c# - File name not showing completely -
this question has answer here:
on our asp.net project, users can download files. here's code i'm using download part:
string localupload = configurationmanager.appsettings["pastaeditais"].tostring(); string nomearquivo = licitacao.getedital(); fileinfo fi = new fileinfo(localupload + nomearquivo); response.clear(); response.addheader("content-disposition", "attachment; filename=" + licitacao.getedital()); response.addheader("content-length", fi.length.tostring()); response.contenttype = "application/octet-stream"; response.writefile(fi.fullname); response.end();
if filename doesn't have white spaces on it, appears normally.
for example: if name ati_06-07-2014.txt, appear this. if has white spaces, part of name shown on download dialog box.
ati 06-07-2014.txt shown 'ati'
how can fix this?
add quotes filename:
response.addheader("content-disposition", "attachment; filename=\"" + licitacao.getedital() + "\"");
Comments
Post a Comment