Do you want to improve this question?Edit this post and update the question to focus on one issue
Closed 7 years ago.
7 years agoAs the title says, I was able to create a file upload function, but I cannot create a download function.
I would like to ask anyone who has experience to teach me.(The framework uses cakePHP)
Rather than cakephp, I think it's a normal php problem.
Create a php like the one below and link from html.
<?php
$file="test.txt";
header("Content-Type: application/octet-stream");
header("Content-Disposition: attachment; filename=$file");
readfile($file);
exit;
?>
There are two ways to do something like cake:
With this method, you don't have to write the response header yourself, so
It might be comfortable.
http://qiita.com/madiehak/items/9b104be97c4c37a3465d
http://www.php-kaihatsu.com/blog/649.html
© 2025 OneMinuteCode. All rights reserved.