how do i get this to work properly?

bradleyx

Member
Messages
108
Reaction score
1
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.
 

bradleyx

Member
Messages
108
Reaction score
1
Points
18
that what i am wanting to know how to do. i search google but i really dont know what to search for.
 
Top