php mysql视频上传功能不成功

时间:2015-07-02 06:45:08

标签: php mysql video

我收到以下错误:

  
      
  1. 警告:mysql_connect()[function.mysql-connect]:为用户访问DENIED' a5467268_andrew' @' 10.1.1.19' (使用密码:YES)在第2行的/home/a5467268/public_html/andrew/fileupload.php中
  2.   
  3. 警告:mysql_select_db():提供的参数不是第3行/home/a5467268/public_html/andrew/fileupload.php中的VALID MySQL-Link资源
  4.   
<?php
$con=mysql_connect("","","");
mysql_select_db("login",$con);
extract($_POST);

$target_dir = "test_upload/";
$target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);

if($upd)
{
//$imageFileType = pathinfo($target_file,PATHINFO_EXTENSION);
$imageFileType= $_FILES["fileToUpload"]["type"];

if($imageFileType != "video/mp4" && $imageFileType != "video/avi" && $imageFileType != "video/mov" && $imageFileType != "video/3gp" && $imageFileType != "video/mpeg")
{
    echo "File Format Not Supported";
} 
else
{
$video_path=$_FILES['fileToUpload']['name'];
mysql_query("insert into video(video_name) values('$video_path')");
move_uploaded_file($_FILES["fileToUpload"]["tmp_name"],"test_upload/".$_FILES["fileToUpload"]["name"]);
echo "uploaded ";
}
}
?>
<form method="post" enctype="multipart/form-data">
Choose Video<input type="file" name="fileToUpload"/>
<input type="submit" value="uplaod" name="upd"/>
</form>

1 个答案:

答案 0 :(得分:0)

  

警告:mysql_connect()[function.mysql-connect]:访问DENIED for   用户&#39; a5467268_andrew&#39; @&#39; 10.1.1.19&#39; (使用密码:YES)in   第2行/home/a5467268/public_html/andrew/fileupload.php

当您为不存在的db用户使用密码时会发生这种情况。

试试这个:

mysql_connect('server_name','db_user','db_user_password');