어떻게하면 내 서버에 php/html 파일이 업로드되지 않도록 할 수 있습니까? 이 코드는 지금까지 가지고 있지만 작동하지 않습니다.PHP - imags에 업로드 된 파일 필터링
<?php
$target = "upload/";
$target = $target . basename($_FILES['uploaded']['name']) ;
$ok=1;
//This is our size condition
if ($uploaded_size > 35000)
{
echo "Your file is too large.<br>";
$ok=0;
}
//This is our limit file type condition
if ($uploaded_type =="text/php")
{
echo "No PHP files<br>";
$ok=0;
}
//Here we check that $ok was not set to 0 by an error
if ($ok==0)
{
Echo "Sorry your file was not uploaded";
}
//If everything is ok we try to upload it
else
{
if(move_uploaded_file($_FILES['uploaded']['tmp_name'], $target))
{
echo "The file ". basename($_FILES['uploadedfile']['name']). " has been uploaded and will be revied by moderators. You will recieve points based on the review.";
}
else
{
echo "Sorry, there was a problem uploading your file.";
}
}
?>
어디'$의 uploaded_size'을받을 수 있나요? – alex
'$ uploaded_type'은 어디에 설정합니까? 그 가치는 무엇입니까? –