How i can change the image name before uploading it to folder?

前端 未结 1 1557
忘了有多久
忘了有多久 2021-01-29 12:44

can someone please help i just need to change the image name before uploading it to folder. whatever user type in here:



        
1条回答
  •  长情又很酷
    2021-01-29 13:18

    I don't know what you are trying to do or why you are doing it, as you haven't provided full details of what you want to change to or why, but here is the code :

     5000000) {
       echo "Sorry, your file is too large.";
       $uploadOk = 0;
    }
    
    if($imageFileType != "jpg" && $imageFileType != "png" && $imageFileType != "jpeg"
    && $imageFileType != "gif" ) {
       echo "Sorry, only JPG, JPEG, PNG & GIF files are allowed.";
       $uploadOk = 0;
    }
    
    if ($uploadOk == 0) {
       echo "Sorry, your file was not uploaded.";
    
    } else {
       if (move_uploaded_file($_FILES["fileToUpload"]["tmp_name"], $target_file)) {
           echo "The file ". basename( $_FILES["fileToUpload"]["name"]). " has been uploaded.";
       } else {
           echo "Sorry, there was an error uploading your file.";
       }
    }
    
    Echo "";
    ?>
    

    0 讨论(0)
提交回复
热议问题