Checking the image during image upload

Hello,
When I want to upload a jpg format image that I took with my compact panasonic camera, it does not have type, tmp_name, size data.

Re-save as with Photoshop
I re-saved it as jpg and png with Paint.
Still no data

// echo '<pre>' . print_r($_FILES, true) . '</pre>';
Array
(
    [logo] => Array
        ( // No problem with another photo
            [name] => 1_org_zoom.jpg
            [type] => image/jpeg
            [tmp_name] => D:\Wampserver64\tmp\php3D1E.tmp
            [error] => 0
            [size] => 303778
        )

    [profil] => Array
        ( // No picture data I took with my Panasonic machine
            [name] => P1000203.jpg
            [type] => 
            [tmp_name] => 
            [error] => 1
            [size] => 0
        )

)

// $size = getimagesize("C:\Users\Adem GENÇ\Desktop/P1000203.jpg");
// print_r($size);

Array ( [0] => 4112 [1] => 3088 [2] => 2 [3] => width="4112" height="3088" [bits] => 8 [channels] => 3 [mime] => image/jpeg )

I need to check during image upload

See the [error] element. You need to test that in your code. It will be a zero if the file uploaded successfully. A value of 1 means -

UPLOAD_ERR_INI_SIZE
Value: 1; The uploaded file exceeds the upload_max_filesize directive in php.ini.

1 Like

I was looking for exactly this feature.
I need to know the meaning of other numbers
Thank you very much

They are defined in the upload handling section in the php.net documentation - PHP: Error Messages Explained - Manual

1 Like
Sponsor our Newsletter | Privacy Policy | Terms of Service