I'm struggling to a problem. I've got a little upload script which is working fine! But I want to make anything similar like the modern download and upload websites. (FRee and Premium Downloads)
My situation right now is the following;
I can pass through a GET variable (file) which contains the filename.. Than the link which the user is getting to redirected to is; localhost:8888/uploads/download.php?file=filename.zip
But what I want to have, is that there is a link similar like; localhost/uploads/file/2d618s
which does not contain the filename.
So what my question is; How can I make a link similar like; localhost/uploads/file/dsa827 <- Unique name
per file instead of localhost/uploads/download.php?file=filename.zip
Below you can see the script which makes a link;
protected function get_download_url($file_name, $version = null, $direct = false) {
if (!$direct && $this->options['download_via_php']) {
$url = $this->options['script_url']
.$this->get_query_separator($this->options['script_url'])
.$this->get_singular_param_name()
.'='.rawurlencode($file_name);
if ($version) {
$url .= '&version='.rawurlencode($version);
}
return $url.'&download=1';
}
How my download template is looking like;
<p class="name">
<form name='download' id='downloadForm' method='POST' action=''>
{% if (file.url) { %}<p>{%=file.name%}</p>
<a href="download.php?file={%=file.name%}" title="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%} name="{%=file.name%}" onclick="document.forms['download'].submit();">Download</a>
{% } else { %}
<span>{%=file.name%}</span>
{% } %}
</p>
</form>
You can also point it out as a shortlink link which many modern upload websites does have... (uploaded.net/file/daj18si -> ul.to/daj18si)
similar like that :)
Thanks in advance!