2 Replies - 420 Views - Last Post: 20 December 2012 - 09:08 AM Rate Topic: -----

#1 don57  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 56
  • Joined: 15-March 12

Trouble with string

Posted 20 December 2012 - 08:50 AM

Trying to replace file name with string in forced download, but get string for file name instead of contents of string


$file_dl="Event Log Cleaner.exe";

header('Content-disposition: attachment; filename=$file_dl');
header('Content-type: application/exe');
readfile('../downloads/$file_dl');



Is This A Good Question/Topic? 0
  • +

Replies To: Trouble with string

#2 no2pencil  Icon User is offline

  • Admiral Fancy Pants
  • member icon

Reputation: 5388
  • View blog
  • Posts: 27,383
  • Joined: 10-May 07

Re: Trouble with string

Posted 20 December 2012 - 08:56 AM

Single quotes do not evaluate variables. Try either of the following :

readfile('../downloads/'.$file_dl);
readfile("../downloads/$file_dl");



Or you could create the full string first & then pass it :

$file = '../downloads/'.$file_dl;
readfile($file);


Was This Post Helpful? 1
  • +
  • -

#3 don57  Icon User is offline

  • D.I.C Head

Reputation: 0
  • View blog
  • Posts: 56
  • Joined: 15-March 12

Re: Trouble with string

Posted 20 December 2012 - 09:08 AM

Thank you
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1