I am doing upload and download script with php. For the upload part, I store the uploaded file, for example, 'my picture.jpg' above my 'htdocs/' with a random name. e.x.:
[-] htdocs |--[+] download [-] upload |--abcdef <<-- 'my picture.jpg' stored as 'abcdef'
The original file name and the new random name is linked by database.
In retrieving the file above, first I create random directory under 'htdocs/download/', copy the file there then rename it back to its original name before handing over the download link.
[-] htdocs |--[-] download |--[-] zyxwvu |--my picture.jpg [-] upload ^ |--abcdef ->- copy
For big files, especially with multiple download request, there will be some unnecessary copy of the files.
My question is, how can I request apache to read the file 'upload/abcdef', and give the link as 'download/zyxwvu/my picture.jpg' so it can be downloaded without an extra copy?