PHP Error - Uploading a file

后端 未结 8 1598
春和景丽
春和景丽 2020-12-16 13:36

I\'m trying to write some PHP to upload a file to a folder on my webserver. Here\'s what I have:



        
8条回答
  •  星月不相逢
    2020-12-16 14:12

    OMG

    move_uploaded_file($_FILES['file']['tmp_name'], './' . $_FILES['file']['name']);
    

    Don't do that. $_FILES['file']['name'] could be ../../../../boot.ini or any number of bad things. You should never trust this name. You should rename the file something else and associate the original name with your random name. At a minimum use basename($_FILES['file']['name']).

提交回复
热议问题