【发布时间】:2017-07-04 14:03:30
【问题描述】:
Move_uploaded_file 不工作。我已经尝试了所有方法,但似乎没有任何效果。
<?php
error_reporting(E_ALL);
ini_set("display_errors", 1);
session_start();
error_reporting( E_ALL ^ E_DEPRECATED );
mysql_connect("127.0.0.1","root","");
mysql_select_db("v-u-a-p");
if(isset($_POST['submit']))
{
$name = $_FILES['file']['name'];
$temp = $_FILES['file']['tmp_name'];
if (move_uploaded_file($temp, "/files/".$name)) {
print "Received {$_FILES['file']['name']} - its size is {$_FILES['userfile']['size']}";
} else {
print "Upload failed!";
}
$url="http://127.0.0.1/Number1Edward/files/$name";
mysql_query("INSERT INTO `videos` VALUE ('','$name','$url')");
}
?>
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<title>Number_1_Edward</title>
<link rel="stylesheet" href="style.css?version=1">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.1.1/jquery.min.js"></script>
<script>
$(document).ready(function(){
$('#sidebar-btn').click(function(){
$('#sidebar').toggleClass('visable');
});
});
</script>
</head>
<body>
<div id="box">
<center><h9 id="Logo">Number_1_Edward</h9></center>
</div>
<div id="sidebar">
<ul>
<li><a href="view.php">Home</a></li>
<li><a href="upload.php">Upload</a></li>
<li><a href="register.php">Register</a></li>
<li><a href="#">About</a></li>
</ul>
<div id="sidebar-btn">
<span></span>
<span></span>
<span></span>
</div>
</div>
<div id='box'>
<h1>Videos and Photos:</h1><p>Upload your videos and photos</p>
<form action="view.php" method='POST' enctype="multipart/form-data">
<input type="file" name="file"/>
<input type="submit" name="submit" value="Upload!"/><br/>
<textarea name="text" cols="40" rows="4" placeholder="Write a discription!(You must right a discription or it wont upload)" type="text"></textarea>
</form>
<?php
if(isset($_POST['submit']))
{
echo"<br/>".$name." has been uploaded";
}
?>
</div>
</body>
</html>
【问题讨论】:
-
“你能帮我快速回答一下吗!” - 截止日期吧?啧啧,太惨了。我们在这里没有截止日期;我们会尽可能回答。
-
抱歉,我不能这么快回答。但是错误就在那里,也很容易看到。下次有礼貌。
-
and answer quick!但我不能快速回答:( -
Felippe Duarte 哪里出错了?
标签: php mysql sql sqlite phpmyadmin