我編寫了一個文件上傳腳本,我想檢查上傳的文件是否爲PHP。如何檢查上傳的文件是否是php?
我想保護我的腳本,以便允許上傳的唯一文件是CSS和XML。
這是我的代碼:
<form action="cp_home.php?mode=up_styles&type=uploading" method="post" enctype="multipart/form-data" name="form1" id="form1">
<input class="fixed" name="ufile" type="file" id="ufile" size="35" />
<input type="button" name="Submit" onclick="upload()" value="up style" />
</form>
請注意,如果啓用了Apache的MultiViews功能,它將查看所有擴展名,並將執行(例如)'foo.php.en'作爲PHP。 – Boann 2013-03-13 13:23:01