1

How do I get a file name to include special characters like ':'?

I need to include a timestamp in my file name in this format: 12:00 PM. Using content-Disposition I am getting 12_00PM.

Graham
  • 7,431
  • 18
  • 59
  • 84
Joe
  • 115
  • 4
  • 17
  • 4
    Some operating systems won't accept : in the filename. – botero Feb 12 '18 at 20:41
  • Is the fact that Windows disallows the colon character in filenames a deal-breaker for you? Are you attached to the format? Because you could [choose a more appropriate format](https://stackoverflow.com/q/12500091/1563833). – Wyck Feb 12 '18 at 21:06
  • Without the OS used, impossible to answer. – Nic3500 Feb 12 '18 at 21:15
  • The file name should be in the format xyz_02122018_4:25PM.xlsx but with content-disposition the colon in the timestamp is replaced with underscore – Joe Feb 12 '18 at 21:26
  • I am using windows – Joe Feb 12 '18 at 21:27

1 Answers1

0

You probably can't, due to security and interoperability considerations. See https://greenbytes.de/tech/webdav/rfc6266.html#rfc.section.4.3.

Julian Reschke
  • 40,156
  • 8
  • 95
  • 98