Go4Expert (http://www.go4expert.com/)
-   PHP (http://www.go4expert.com/forums/php/)
-   -   rename file on download (http://www.go4expert.com/forums/rename-file-download-t17706/)

Mariam 26May2009 21:19

rename file on download
Then I upload the file, for example "MG_CV.doc" the php code renames the file to "38912831_7183791.doc" and then uploads it. In database are saved the old and new names of the files (MG_CV.doc, 38912831_7183791.doc).

After I call
<a href='MG_CV.doc'>download file</a>
I need on clicking on "download file" download 38912831_7183791.doc but in "save as dialog" must be "MG_CV.doc" how can I do this in PHP

pradeep 27May2009 00:00

Re: rename file on download
What PHP script uploads your files? How do you serve i.e. allow download of these files through a PHP script or direct download?

Mariam 27May2009 22:02

Re: rename file on download
Upload script is not necessary. In database I have real name of the file(MG_CV.doc) and renamed file (38912831_7183791.doc).
The real file that exists in server is 38912831_7183791.doc. I need download 38912831_7183791.doc file.
I wrote <a href='MG_CV.doc'>download file</a>, by clicking on "download file" must be opened save dialog and be downloaded with this "MG_CV.doc" name

pradeep 27May2009 23:39

Re: rename file on download
To provide the real name for the download either you have keep it in the same name or you have to pass the Content-Disposition header which should include the filename to be shown for Save As

All times are GMT +5.5. The time now is 15:38.