Answer the question
In order to leave comments, you need to log in
How to give a file from the server with a unique name?
Hello.
A file is dynamically created on the server so as not to take up space on the server, under one name. Is it possible to give it with a unique name when downloading?
Generated with PHPExcel.
Thank you.
Answer the question
In order to leave comments, you need to log in
Option 1: when uploading a file, issue the header
Content-Disposition:attachment; filename=your_file_name
Option 2: generate the file dynamically, save it on the server, redirect to it. If you save space, you can delete the file that was generated last time before this.
Option 3: if the option of uploading a file via a direct link, as in option 2, does not suit you, you can do it a little differently. You first generate a link, at the end of which there will be a random name, for example:
path/to/script.php/random_file_name.txt
In the server config, use Rewrite to remove the last segment. Well, the Browser will offer to save the file exactly with the name that comes in the URL after the last slash.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question