PHP upload image

前端 未结 10 2480
不知归路
不知归路 2020-12-06 01:46

Alright I have way to much time invested in this. I am new to PHP programming and trying to grasp the basics, but I am a little lost as of last night I was able to get a PHP

10条回答
  •  时光说笑
    2020-12-06 02:01

    Here is a basic example of how an image file with certain restrictions (listed below) can be uploaded to the server.

    • Existence of the image.
    • Image extension validation
    • Checks for image size.

       2097152){
               $errors[]='File size must be excately 2 MB';
            }
      
            if(empty($errors)==true){
              move_uploaded_file($file_tmp,"images/".$newfilename.".".$file_ext);
              echo "Success";
              echo "";
      
            }
      
            else{
               print_r($errors);
            }
         }
      ?>
      
         
      
            

      Credit to this page.

提交回复
热议问题