实际上我将三个值存储在数据库中,它成功存储日期、路径但不存储画廊 ID,这是我正在使用的代码
<?php ob_start();
session_start();
include("include/conf.php");
$getid=$_GET['id_cms'];
$galleryid=$_GET['gallery'];
$date=date("F j, Y, g:i a");
$targetFolder = '/uploads'; // Relative to the root
$verifyToken = md5('unique_salt' . $_POST['timestamp']);
if (!empty($_FILES) && $_POST['token'] == $verifyToken) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $_SERVER['DOCUMENT_ROOT'] . $targetFolder;
//$targetFile = rtrim($targetPath,'/') . '/' . $_FILES['Filedata']['name'];
// Validate the file type
$fileTypes = array('jpg','jpeg','gif','png'); // File extensions
$fileParts = pathinfo($_FILES['Filedata']['name']);
if (in_array($fileParts['extension'],$fileTypes)) {
//move_uploaded_file($tempFile,$targetFile);
move_uploaded_file($tempFile,"gallery/".$_FILES['Filedata']['name']);
$path=$_FILES['Filedata']['name'];
mysql_query("Insert into gallery (gall_date,albumid,gallery_path) VALUES('$date','$galleryid','$path')",$cn) or die("Insert Query Error");
}} ?>
我已经花了两天时间,但都是徒劳的。
任何机构都可以解决我的问题。提前致谢