Jump to content

thefall

New Members
  • Posts

    6
  • Joined

  • Last visited

Posts posted by thefall

  1. @Ch0cu3r

     

    I converted the imagejpeg() and header lines into comments. 

     

    There were no error messages on google chrome and firefox.

     

     

    What I've noticed is that the line below would be displayed if you remove the imagejpeg() and header lines, whereas if you include the imagejpeg() and header lines, the line below wouldn't be displayed .I inserted the line below in the code, just to check where it would stop being displayed.

    echo 'asdsad';
    
  2. Hi.

     

    I have a problem where when i try to display the uploaded JPEG file, the browser would only dispay the placeholder for an image . I think the problem is within the 3rd IF statement.

     

    Please help me thanks.

    <?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') {
    		
    		echo 'asdsad';
    		
    			$tmp_img = $_FILES['photo']['tmp_name'];
    			
    			$image = imagecreatefromjpeg($tmp_img);
    			
    			header('Content-Type: image/jpeg');
    			
    			imagejpeg($image, NULL, 90);
    			
    			imagedestroy($image);
    
    			
    			
    		} else {
    		echo "Uploaded file was not a JPG image.";
    		}
    } else {
    echo "No photo uploaded!";
    }}
    
    else {
    echo "
    <form action='test.php' method='post'
    enctype='multipart/form-data'>
    <label for='photo'>User Photo:</label>
    	<input type='file' name='photo' />
    	<input type='submit' value='Upload a Photo' />
    </form>
    
    ";} ?>
    
×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.