True URL for Download Links from standard file uploader

Permalink
I know it might be easy , but i cannot figure it ou, so your help and patience with someone new to Concrete5 is appreciated. How does one go about changing the URL structure of links for items uploaded from the file manager block? Basically I wanted to know how when a file is uploaded in the backend can one change the links fromwww.www.example.com/download_file/9/1... tohttp://www.example.com/test.pdf by default? I am using a third party script for tracking that does not work unless the exact file type is in the URL.

adrianspeyer
View Replies: View Best Answer
Mnkras replied on at Permalink Reply
Mnkras
they best you will be able to do is get a url like

site.com/files/3451/6314/2626/some-file.pdf
adrianspeyer replied on at Permalink Reply
adrianspeyer
Yes that's perfect, but how do I do that? Can you advise which file(s) I need to modify? :)
adrianspeyer replied on at Permalink Reply
adrianspeyer
I found that I may be able to use $fileVersion->getURL() instead of $fileVersion->getDownloadURL(), but where would I make this change?
adrianspeyer replied on at Permalink Best Answer Reply
adrianspeyer
Finally got the answer, for those looking for it. To help those in the future I decided to post it:

What you need to do is copy view.php of the pathtoyourconcrete/concrete/blocks/file
to your root concrete and modify the lines commented out:

$fo = $this->controller->getFileObject();?>
<a href="<?php echo $fo->getRelativePath()?>"><?php echo  stripslashes($controller->getLinkText()) ?></a>


Works like a charm!