php - 我想将文件存储到两个不同的文件夹位置,但它显示错误
问题描述
这是我编写的将数据分别存储到两个文件夹中的代码,但它显示错误,或者有人可以纠正我以帮助我。还有另一种方法可以将数据存储到不同的文件夹中吗?Parse error: syntax error, unexpected '$folder1' (T_VARIABLE) in C:\xampp\htdocs\scienceworld\admin\code.php on line 91
它在 move_uploaded_files 之后显示此错误。
if(isset($_POST['add_maths']))
{
$title = $_POST['title'];
$description = $_POST['description'];
$datatype = $_POST['datatype']; // here i define two values PDF and Video
$files = $_FILES["content"]['name'];
$ext = pathinfo($files, PATHINFO_EXTENSION);
if ($ext == '.Application')
{
$folder = "upload/PDF/";
}
else
{ $ext == '.Video';//you can add allowed video extensions here
$folder1 = "upload/"; (here it shows error)
}
if(file_exists($folder||$folder1.$_FILES["content"]['name']))
{
$store = $_FILES["content"]['name'];
$_SESSION['status'] = "File Already Exist. '.$store.'";
header('Location: 8thmaths.php');
}
else
{
$query = "INSERT INTO 8maths (title,description,datatype,files) VALUES ('$title','$description','$datatype','$files')";
$query_run = mysqli_query($connection, $query);
if($query_run)
{
// echo "Saved";
move_uploaded_file($_FILES["content"]['tmp_name'], ($folder,$folder1.$_FILES["content"]['name']);
$_SESSION['success'] = "Data is Added";
header('Location: 8thmaths.php');
}
else
{
$_SESSION['status'] = "Data is Not Added";
header('Location: 8thmaths.php');
}
}
}
解决方案
推荐阅读
- 7zip - 7Zip 网络
- jquery - 如何确保每次都可以调用剑道网格 detailInit
- amazon-web-services - TypeError:AWS.PinpointSMSVoice 不是构造函数
- javascript - 使用 npm csv-writer 写入 csv 文件不起作用,但没有出现错误消息
- python - 允许 TensorFlow 同时使用 GPU 和物理系统内存
- rust - serde 跳过属性实际上会跳过枚举变体吗?
- jestjs - 测试是否使用特定参数(来自组件)调用了 Vuex 操作
- regex - 用正则表达式匹配字符串结尾前的一个或多个 0 符号
- json - Apache Flink:无法从 ObjectNode::get 中提取密钥
- python - Django Rest 框架:自定义 IsReadOnly 权限