简体   繁体   中英

How to add “/” in file name of Content-Disposition

I tried bellow code for giving file name when downloading a file

  HttpContext.Current.Response.AppendHeader("content-disposition", "attachment; filename=" + ("dddd/aa/www.ppt"));

but after downloading all "/" is replaced by "_" in the file name,this is the downloaded file name "dddd_aa_www.ppt".But I need to keep / in my file name.how can i keep this character in my file name

Saving a file with "/" is restricted.

So this is an automatic feature of that method.

I would change your naming convention to leave out these specific characters:

What characters can't be in a file name?
Reserved characters and words
Character   Name
\   backslash
/ slash
?   question mark
%   percent
*   asterisk or star
:   colon
|   vertical bar
"   quote
<   less than
>   greater than
.   period
    Space

https://en.wikipedia.org/wiki/Filename

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM