Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <html>
- <head>
- <title></title>
- </head>
- <body>
- <?php
- if( ( $_SERVER['REQUEST_METHOD'] ) == "POST" )
- {
- if(
- isset( $_FILES['photo'] ) &&
- is_uploaded_file( $_FILES['photo']['tmp_name'] ) &&
- $_FILES['photo']['error'] = 'UPLOAD_ERR_OK'
- )
- {
- if( $_FILES['photo']['type'] == "image/jpeg" )
- {
- // Creates an image resource
- $image = imagecreatefromjpeg($tmp_img);
- // Tells the browser what type of file
- header('Content-Type: image/jpeg');
- // Outputs the file to the browser
- imagejpeg($image);
- // Frees the memory used for the file
- imagedestroy($image);
- }
- else
- {
- echo "<p>Uploaded File was not jpeg</p>";
- }
- }
- else
- {
- echo "No file uploaded";
- }
- }
- else
- {
- ?>
- <form action="" method="post" enctype="multipart/form-data" >
- <table>
- <tr>
- <td><label>Choose File to Upload</label></td>
- <td><input type='file' name="photo" ></td>
- </tr>
- <tr>
- <td></td>
- <td><input type="submit" name="submitButton"></td>
- </tr>
- </table>
- </form>
- <?php } ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement