+ 6
What is the best way to download something in php?
I am in search to find the best way to download something (image for example) which is in the same folder as the PHP file
6 Réponses
+ 10
you can try that link..
+ 8
This link helpful for you..
https://www.javatpoint.com/php-tutorial
All the best..
+ 2
Thanks, I will see if I can an answer. On the precedent message, I said that I have find a download system with headers, there he is:
header(“Content-description : File transfer”);
header(“Content-type : application/octet-stream”);
header(“Content-Disposition : attachment; filename = “. Nameofthefile);
ob_clean();
readfile(“folder/”Nameofthefile);
+ 2
I try to do this but it doesn't work:
https://youtu.be/pZxv-5V0_Dg
(in French)
0
I think the reason you are not getting answers is that the question is not very clear. If you are trying to get the image from the server to your client browser, you only need an http request, not PHP. If you are trying to download an image to your computer, you should use an ftp protocol on the client side (probably what the browser is doing behind the scene). If you are trying to get the server to send you a file, you can probably do it with a combination of PHP (server) and FTP (transfer) but that would be weird.
I think you will have more luck with your question if you clarify what you are trying to achieve and ask a more precise question.Good luck Antoine.
0
Thank you for your answer, my question is about downloading files (IMG, text...)from the same folder as the PHP file. I need for example, to click on a button (when the PHP file is open) and get (download on my computer) the file that I want to get. I have seen some download system using headers but I would like to know what's the best download system. I hope that my question is more comprehensive now.
PS: if my English is not perfect, sorry, because I'm french