Advertisement
Achilles

Untitled

Jul 3rd, 2013
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.14 KB | None | 0 0
  1. <html>
  2. <head>
  3. <title></title>
  4. </head>
  5. <body>
  6.  
  7. <?php
  8.  
  9. if( ( $_SERVER['REQUEST_METHOD'] ) == "POST" )
  10. {
  11. if(
  12. isset( $_FILES['photo'] ) &&
  13. is_uploaded_file( $_FILES['photo']['tmp_name'] ) &&
  14. $_FILES['photo']['error'] = 'UPLOAD_ERR_OK'
  15. )
  16. {
  17. if( $_FILES['photo']['type'] == "image/jpeg" )
  18. {
  19. // Creates an image resource
  20. $image = imagecreatefromjpeg($tmp_img);
  21. // Tells the browser what type of file
  22. header('Content-Type: image/jpeg');
  23. // Outputs the file to the browser
  24. imagejpeg($image);
  25. // Frees the memory used for the file
  26. imagedestroy($image);
  27. }
  28.  
  29. else
  30. {
  31. echo "<p>Uploaded File was not jpeg</p>";
  32. }
  33. }
  34.  
  35. else
  36. {
  37. echo "No file uploaded";
  38. }
  39. }
  40.  
  41. else
  42. {
  43. ?>
  44.  
  45. <form action="" method="post" enctype="multipart/form-data" >
  46.  
  47. <table>
  48.  
  49. <tr>
  50. <td><label>Choose File to Upload</label></td>
  51. <td><input type='file' name="photo" ></td>
  52. </tr>
  53.  
  54. <tr>
  55. <td></td>
  56. <td><input type="submit" name="submitButton"></td>
  57. </tr>
  58. </table>
  59.  
  60. </form>
  61.  
  62. <?php } ?>
  63.  
  64. </body>
  65. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement