yolop Posted September 5, 2008 Share Posted September 5, 2008 I have an image on my server and I want a code in php that download image how please? Link to comment https://forums.phpfreaks.com/topic/122853-how-do-download-image/ Share on other sites More sharing options...
trq Posted September 5, 2008 Share Posted September 5, 2008 Your question is very unclear. Are you asking how your clients would download a file from your server? Simply provide them a link. eg; http://foo.com/image.jpg Link to comment https://forums.phpfreaks.com/topic/122853-how-do-download-image/#findComment-634484 Share on other sites More sharing options...
yolop Posted September 5, 2008 Author Share Posted September 5, 2008 Your question is very unclear. Are you asking how your clients would download a file from your server? Simply provide them a link. eg; http://foo.com/image.jpg no for ex. i want to creat a PHP PAGE that download this image http://www.phpfreaks.com/forums/Themes/default/images/h_powered-php.gif when the clients come into this page he will download the image Link to comment https://forums.phpfreaks.com/topic/122853-how-do-download-image/#findComment-634503 Share on other sites More sharing options...
trq Posted September 5, 2008 Share Posted September 5, 2008 Maybe your talking about forcing a download? Who knows? Does this help? Link to comment https://forums.phpfreaks.com/topic/122853-how-do-download-image/#findComment-634506 Share on other sites More sharing options...
yolop Posted September 5, 2008 Author Share Posted September 5, 2008 Maybe your talking about forcing a download? Who knows? Does this help? the function readfile not allow in my server Link to comment https://forums.phpfreaks.com/topic/122853-how-do-download-image/#findComment-634508 Share on other sites More sharing options...
prcollin Posted September 5, 2008 Share Posted September 5, 2008 Tell us Are you trying to set it up for a clickable download or a forced download. Do you want the file to automatically dl when the person enter the page? Link to comment https://forums.phpfreaks.com/topic/122853-how-do-download-image/#findComment-634529 Share on other sites More sharing options...
freeloader Posted September 5, 2008 Share Posted September 5, 2008 Your question is very unclear. Are you asking how your clients would download a file from your server? Simply provide them a link. eg; http://foo.com/image.jpg no for ex. i want to creat a PHP PAGE that download this image http://www.phpfreaks.com/forums/Themes/default/images/h_powered-php.gif when the clients come into this page he will download the image I think what you're trying to do is display the image to the user right? In that case, just put it in <img> tags. Basic html knowledge is necessary in order to code php... Link to comment https://forums.phpfreaks.com/topic/122853-how-do-download-image/#findComment-634549 Share on other sites More sharing options...
yolop Posted September 5, 2008 Author Share Posted September 5, 2008 Tell us Are you trying to set it up for a clickable download or a forced download. Do you want the file to automatically dl when the person enter the page? yhe i want that image http://www.phpfreaks.com/forums/Themes/default/images/h_powered-php.gif download automatically when the user enter the page Your question is very unclear. Are you asking how your clients would download a file from your server? Simply provide them a link. eg; http://foo.com/image.jpg no for ex. i want to creat a PHP PAGE that download this image http://www.phpfreaks.com/forums/Themes/default/images/h_powered-php.gif when the clients come into this page he will download the image I think what you're trying to do is display the image to the user right? In that case, just put it in <img> tags. Basic html knowledge is necessary in order to code php... no no no i don't trying to do is display the image i want to let the user download the image Link to comment https://forums.phpfreaks.com/topic/122853-how-do-download-image/#findComment-634563 Share on other sites More sharing options...
freeloader Posted September 5, 2008 Share Posted September 5, 2008 In that case you're looking for a force download script which will be pretty much impossible of your server doesn't support readfile as you said earlier. Link to comment https://forums.phpfreaks.com/topic/122853-how-do-download-image/#findComment-634570 Share on other sites More sharing options...
discomatt Posted September 5, 2008 Share Posted September 5, 2008 In that case you're looking for a force download script which will be pretty much impossible of your server doesn't support readfile as you said earlier. Why? Can't he use echo file_get_contents( 'filename', ); or fopen/fread/echo? Link to comment https://forums.phpfreaks.com/topic/122853-how-do-download-image/#findComment-634588 Share on other sites More sharing options...
yolop Posted September 6, 2008 Author Share Posted September 6, 2008 In that case you're looking for a force download script which will be pretty much impossible of your server doesn't support readfile as you said earlier. Why? Can't he use echo file_get_contents( 'filename', ); or fopen/fread/echo? no if i write <?php echo file_get_contents( '1.gif'); ?> it's only give me some understood code i want to download.... Link to comment https://forums.phpfreaks.com/topic/122853-how-do-download-image/#findComment-635345 Share on other sites More sharing options...
BlueSkyIS Posted September 6, 2008 Share Posted September 6, 2008 you'd need to first send a header identifying the code as a .gif image. Link to comment https://forums.phpfreaks.com/topic/122853-how-do-download-image/#findComment-635356 Share on other sites More sharing options...
yolop Posted September 6, 2008 Author Share Posted September 6, 2008 you'd need to first send a header identifying the code as a .gif image. how...? Link to comment https://forums.phpfreaks.com/topic/122853-how-do-download-image/#findComment-635362 Share on other sites More sharing options...
BlueSkyIS Posted September 6, 2008 Share Posted September 6, 2008 header("Content-Type: image/gif"); echo file_get_contents('1.gif'); exit; Link to comment https://forums.phpfreaks.com/topic/122853-how-do-download-image/#findComment-635385 Share on other sites More sharing options...
yolop Posted September 6, 2008 Author Share Posted September 6, 2008 header("Content-Type: image/gif"); echo file_get_contents('1.gif'); exit; no i write that code <?php header("Content-Type: image/gif"); echo file_get_contents('1.gif'); exit; ?> and it's show the picture'no download that.... Link to comment https://forums.phpfreaks.com/topic/122853-how-do-download-image/#findComment-635400 Share on other sites More sharing options...
BlueSkyIS Posted September 6, 2008 Share Posted September 6, 2008 maybe try something like this: http://www.phpit.net/code/force-download/ Link to comment https://forums.phpfreaks.com/topic/122853-how-do-download-image/#findComment-635405 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.