SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Enthusiast
    Join Date
    Sep 2012
    Location
    BD
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Wanna add picture download option in my site help me please .

    Hello Friends,
    I want to add photo gallary and wallpaper section in my site so that if i upload any photo and give a download link its show only that picture but its not downloading. Example : If we view any photo in FACEBOOK so we can see a DOWNLOAD option and if we click on that the picture is download , my ques is how can i do like that option? with javascript ? do u know that? then please tell me that

    Thank you In adVance

  2. #2
    SitePoint Evangelist
    Join Date
    Apr 2009
    Location
    South Carolina
    Posts
    458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by anturj View Post
    Hello Friends,
    I want to add photo gallary and wallpaper section in my site so that if i upload any photo and give a download link its show only that picture but its not downloading. Example : If we view any photo in FACEBOOK so we can see a DOWNLOAD option and if we click on that the picture is download , my ques is how can i do like that option? with javascript ? do u know that? then please tell me that

    Thank you In adVance
    There may be other ways, but this one works for me.

    PHP Code:
    <?php
    $filename 
    "something.jpg";

    header("Content-Length: " filesize($filename));
    header('Content-Type: application/octet-stream');
    header('Content-Disposition: attachment; filename=something.jpg');

    readfile($filename);
    ?>
    Name this short bit of PHP with a name of "something.php" and have this as the target for your download button.
    Each day is a learning experience.

  3. #3
    SitePoint Enthusiast
    Join Date
    Sep 2012
    Location
    BD
    Posts
    49
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    <?php
    $file = $_GET['file'];

    header("Content-Type: application/octet-stream; ");
    header("Content-Transfer-Encoding: binary");
    header('Content-Disposition: attachment; filename="'.basename($file).'"');
    readfile($file);
    ?>
    i get this but will u tell me how can i make download links...

  4. #4
    SitePoint Evangelist
    Join Date
    Apr 2009
    Location
    South Carolina
    Posts
    458
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by anturj View Post
    i get this but will u tell me how can i make download links...
    Here is a link that will give you a start on HTML links.
    Each day is a learning experience.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •