关于PHP图片修改功能的问题
这是表单的处理程序if($_POST['updata']){$sid=addslashes($_POST['sid']);$title=addslashes($_POST...
这是表单的处理程序
if($_POST['updata']){
$sid = addslashes($_POST['sid']);
$title = addslashes($_POST['title']);
$link = addslashes($_POST['link']);
$path = 'source/plugin/sap_vl/upload/';
$file_name = $_FILES["file"]["name"];
$typename = explode("." , $file_name);
for ($i=0; $i < count($typename); $i++) {
$type = $typename[$i];
}
$newname = $path.rand(0,9).time().'.'.$type;
echo $_FILES["file"]["tmp_name"];
echo "<br>";
echo $newname;
if(move_uploaded_file($_FILES["file"]["tmp_name"], $newname)
&&
DB::query("update `pre_sap_vl_video` SET `time` = '".time()."',`link` = '".$link."',`title` = '".$title."',`sid` = '".$sid."',`img` = '".$newname."' where id='".$sid."'")){
$message = '修改成功,请不要直接刷新本页面'.'<a href="plugin.php?id=sap_vl:admin">点击返回</a>';
}
}
代码不是我写的,我只是改了一下,要实现图片修改功能,貌似不对,大家看看哪里有问题 展开
if($_POST['updata']){
$sid = addslashes($_POST['sid']);
$title = addslashes($_POST['title']);
$link = addslashes($_POST['link']);
$path = 'source/plugin/sap_vl/upload/';
$file_name = $_FILES["file"]["name"];
$typename = explode("." , $file_name);
for ($i=0; $i < count($typename); $i++) {
$type = $typename[$i];
}
$newname = $path.rand(0,9).time().'.'.$type;
echo $_FILES["file"]["tmp_name"];
echo "<br>";
echo $newname;
if(move_uploaded_file($_FILES["file"]["tmp_name"], $newname)
&&
DB::query("update `pre_sap_vl_video` SET `time` = '".time()."',`link` = '".$link."',`title` = '".$title."',`sid` = '".$sid."',`img` = '".$newname."' where id='".$sid."'")){
$message = '修改成功,请不要直接刷新本页面'.'<a href="plugin.php?id=sap_vl:admin">点击返回</a>';
}
}
代码不是我写的,我只是改了一下,要实现图片修改功能,貌似不对,大家看看哪里有问题 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询