how do i get this to work properly?

Discussion in 'Scripts, 3rd Party Apps, and Programming' started by bradleyx, Sep 30, 2014.

  1. bradleyx

    bradleyx Member

    Messages:
    108
    Likes Received:
    1
    Trophy Points:
    18
    Code:
    <?php
      $name = $_GET['name'];
      $mimes = array
      (
      'jpg' => 'image/jpg',
      'jpeg' => 'image/jpg',
      'gif' => 'image/gif',
      'png' => 'image/png'
      );
    
      $ext = strtolower(end(explode('.', $name)));
    
      $file = 'img/'.$name;
       $file = 'images/'.$name;
       $file = 'upload/'.$name;
      header('content-type: '. $mimes[$ext]);
      header('content-disposition: inline; filename="'.$name.'";');
      readfile($file);
    ?>
    
    i am trying to use php to load up images instead of using direct links
    example: img/file.png

    i want: img.php?name=file.ext.

    i also want it where when ppl try to save it it saves it as php instead of a image.
     
  2. caftpx10

    caftpx10 Well-Known Member

    Messages:
    1,501
    Likes Received:
    109
    Trophy Points:
    63
    I don't see any checks limiting uploads to images.
     
  3. bradleyx

    bradleyx Member

    Messages:
    108
    Likes Received:
    1
    Trophy Points:
    18
    that what i am wanting to know how to do. i search google but i really dont know what to search for.
     
  4. caftpx10

    caftpx10 Well-Known Member

    Messages:
    1,501
    Likes Received:
    109
    Trophy Points:
    63
    Search for 'image upload restrictions'.
     

Share This Page