我要提供上传服务,但我几天问自己的问题是,如何制作像现代上传服务这样的下载页面?现在,当我点击"下载"我可以直接下载我的文件。但我想要一个免费版和高级版的页面来下载文件。
您可以在下面看到我如何制作下载网址:
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';
}
if (empty($version)) {
$version_path = '';
} else {
$version_url = @$this->options['image_versions'][$version]['upload_url'];
if ($version_url) {
return $version_url.$this->get_user_path().rawurlencode($file_name);
}
$version_path = rawurlencode($version).'/';
}
return $this->options['upload_url'].$this->get_user_path()
.$version_path.rawurlencode($file_name);
}
显示我使用的下载链接;
<p class="name">
<form name='download' id='downloadForm' method='POST' action='download.php'> //Tried to use a form and get the POST value, but didn't work
{% if (file.url) { %}<p>{%=file.name%}</p>
<a href="{%=file.url%}" title="{%=file.name%}" download="{%=file.name%}" {%=file.thumbnailUrl?'data-gallery':''%} name="{%=file.name%}" onclick="document.forms['download'].submit();">Download</a>
{% } else { %}
<span>{%=file.name%}</span>
{% } %}
</p>
</form>
任何帮助都表示赞赏,我挣扎了好几天..
提前致谢!