Hello,

I'd like to know how best to modify $url so that I can customize some items in the path.

In my case I'd like to replace the 'files/filefield_stats' portion with something like folder1/folder2.

However, I find that removing or replacing 'files/filefield_stats' from the url breaks the link. Also, I find that sometimes the downloaded file name is the hash key and does not give the user the extension, so I need to append the filename_or_filealias.ext to the url (or an alias with the extension).

http://www.example.com/folder1/folder2/5/77/4/d4df983bbca181f8c9ef7683db1c3ab0/filename.ext

What is the best way to achieve this....and thanks in advance for your help,

KH

Comments

nicholasThompson’s picture

Status: Active » Closed (won't fix)

You could look into create URL Aliases for this, however I dont think this will work very well as the URL contains the Node and User ID which would create thousands of permutations per file.

You may have some luck with the Subpath Alias module.

As for the download filename being the hash... I'll have to investigate this. Is this an Internet Explorer bug? Please open a separate ticket for this bug if you can provide steps to reproduce the bug.

Cheers,

fietserwin’s picture

Status: Closed (won't fix) » Active

Regarding the extension part, I think that we should give this a second thought. I've seen some minor problems when using the wrong or an incorrect extension as well (using imagecache to go from a jpg to a png). not so much in browsers, but more when I wanted to open the downloaded file locally on my own (Windows) system, which is completely extension oriented to choose the application when opening a file.

fietserwin’s picture

Title: Adding File Alias & Custom Folder Names To The Url » Adding extension to the url