Problem with time format in filename using content dispositi

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
sknarula
Forum Newbie
Posts: 1
Joined: Fri Apr 10, 2015 12:25 pm

Problem with time format in filename using content dispositi

Post by sknarula »

Hello,

I am trying to download the excel file and upon downloading the file, the time in file name is changed. Here is the code snippet:

fileName = "XYZ_10-Apr-2015_13:14:52.csv";
header("Content-type: application/x-msexcel");
header("Content-disposition: attachment; filename=\"$fileName\"");
header("Pragma: no-cache");
header("Expires: 0");

However, in the downloads folder, the name of the file is "XYZ_10-Apr-2015_13_14_52.csv". I am trying to figure out the reason why my file name is changed upon download i.e. ":" is changed to "_" in time portion.

Can someone please help with this issue.

Thanks,
SK
User avatar
Celauran
Moderator
Posts: 6427
Joined: Tue Nov 09, 2010 2:39 pm
Location: Montreal, Canada

Re: Problem with time format in filename using content dispo

Post by Celauran »

You can't use : in a file name
Post Reply