Php upload image to directory

后端 未结 6 387
野的像风
野的像风 2021-01-13 16:25

Ive been experimenting with the upload capability of php, I have been looking at this tutorial on w3school.

http://www.w3schools.com/php/php_file_upload.asp
         


        
6条回答
  •  醉梦人生
    2021-01-13 17:26

    I agree with answer of Ivo but I think that you may make change of next piece of code like this:

    $typePicture = array('jpg','png','jpeg','gif');
    
    // Allow certain file formats
    
    if($typePicture[0] != "jpg" || $typePicture[1] != "png" || $typePicture[2] != "jpeg" || $typePicture[3] != "gif" ) 
    {
        echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
        $uploadOk = 0;
    }
    

提交回复
热议问题