1

I managed to "hide" files using "private folders". The problem with this is that, when I upload an image called "cat.jpg", it will appear in the file system as "cat.jpg". If I then try to view it, the URL will be something like /system/files/styles/medium/private/cat.jpg?itok=fDHu1Q5k.

Is there a way to obfuscate the name, so that it will instead be something like /system/files/styles/medium/private/2342343534532122.jpg?itok=fDHu1Q5k?

To be clear, I want whoever uploads the file to be able to upload it as "cat.jpg". When it hits the file system, it must still be stored as cat.jpg. Only when it's opened displayed as URL, must the filename be changed. Yes, I know, changing the filename on upload would probably be easier, but there are just too many already uploaded files for me to consider this route, and I still want to be able to browse through the files on the filesystem using the original names.

3
  • Do you just want random filenames for uploaded files (e.g. cat.jpg becomes duwu273uehd.jpg for everyone) or random filename for each request? (e.g. cat.jpg is once q209eueiofhea.jpg for one user, then qioueiehfjsdf.jpg for another etc)
    – m1n0
    Feb 18, 2014 at 19:24
  • I updated my question. Feb 18, 2014 at 19:26
  • You can change the file name using Apache's RewriteRule ( eg: stackoverflow.com/questions/6218061/…)
    – AgA
    Feb 19, 2014 at 6:52

1 Answer 1

1

You can use apache module mod-auth-token (https://code.google.com/p/mod-auth-token/) to generate a one-time url. Please refer to the documentation for more specific instructions (there is both apache configuration and php example how to use it).

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.