0
나는 "비디오 업로드 사이트"라는 베타를 만들었지 만 사람들은 아무 것도 업로드하지 않고 업로드를 눌러서 데이터베이스와 비디오 사이트를 스팸화할 수 있습니다. 어떻게하면 업로드 할 수 있습니까? 파일 attchedphp 양식 없음 파일 업로드 없음
내 코드는 다음과 같습니다
<?php
mysql_connect("ip","username","password");
mysql_select_db("database");
if(isset($_POST['submit']))
{
$name = $_FILES['file']['name'];
$temp = $_FILES['file']['tmp_name'];
move_uploaded_file($temp,"uploaded/".$name);
$url = "http://www.mysite.dk/videoer/uploaded/$name";
mysql_query("INSERT INTO `videos` VALUE ('','$name','$url')");
}
?>
<html>
<head>
<title>Upload din video | Se videoer</title>
</head>
<body>
<a href="videoes.php">Videoer</a>
<form action="index.php" method="POST" enctype="multipart/form-data">
<input type="file" name="file" />
<input type="submit" name="submit" value="Upload!" />
</form>
<?php
if(isset($_POST['submit']))
{
echo "<br />".$name." Er blevet uploadet";
}
?>
</body>
</html>
유효성 검사라고합니다. http://www.smashingmagazine.com/2009/07/07/web-form-validation-best-practices-and-tutorials/ – Leeish