0
我想上傳圖像到這個文件夾叫做roomPhoto。然後從那裏我想要sql服務器數據庫名稱imagepath存儲路徑,而不是圖像本身。有人可以幫我弄這個嗎?一切都在數據庫中上傳除了圖像
session_start();
include "../../lib/mssql.connect.php";
$target = "roomPhoto/";
$target = $target . basename($_FILES['photo']['imagepath']);
$params = array($_POST['xone'],$_POST['yone'], $_POST['xtwo'], $_POST['ytwo'], $_POST['venue'] , $_POST['description'] , $_POST['roomlevel'], ($_FILES['photo']['imagepath']));
$sql = "INSERT INTO map(x1, y1, x2, y2, venue, description, roomLevel, imagepath)
VALUES (?,?,?,?,?,?,?,?)";
$result = sqlsrv_query($conn, $sql, $params);
echo "Account had been successfully created";
哪裏是你的HTML表單?它看起來像你缺少'enctype'。 –
您需要添加'move_uploaded_file'來移動特定的文件夾。看來你還沒有用過它。即使名稱被保存,文件夾中也不會有任何圖像,並且會顯示破碎的圖像 – Nehal