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? Quote Link to comment 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 Quote Link to comment 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 Quote Link to comment 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? Quote Link to comment 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 Quote Link to comment 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? Quote Link to comment 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... Quote Link to comment 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 Quote Link to comment 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. Quote Link to comment 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? Quote Link to comment 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.... Quote Link to comment 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. Quote Link to comment 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...? Quote Link to comment 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; Quote Link to comment 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.... Quote Link to comment 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/ Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.