0

When I search for an answer from the web, most suggest using header() function, like the following:

$testing = $_REQUEST['filename'];
header("Content-type: application/csv");
header("Content-Disposition: attachment; filename=".$testing);
header("cache-control: private");
header("pragma: private");

However, this would only force the user to download a csv file to the default position.

What I want to do is to generate a prompt box to ask the user where to save the file, like the "Save As" dialog box created by Application.GetSaveAsFilename in VBA.

Yan Berk
  • 14,328
  • 9
  • 55
  • 52
cytsunny
  • 4,838
  • 15
  • 62
  • 129
  • 6
    This behaviour is largely up to the browser itself. If the user has set their browser to download files to a default location, there's not much you can do about it. – J. Steen Aug 15 '12 at 09:14
  • 1
    That behavior is determined by the browser, as J. Steen pointed out. However, if you *really* need a prompt for where to save the file, you could use a plugin like Flash or Java to produce the save prompt. Please don't, though. – Snowball Aug 21 '12 at 18:51
  • 1
    If this were possible, it would be a job for the client side, however, for security reasons, the client side has no control over where a file is saved by default (for good reason, you wouldn't want a file replacing any of your system files) – Austin Aug 21 '12 at 18:51
  • You cant do that cuz , evry user can set their own default location where to download files –  Aug 21 '12 at 18:51

0 Answers0