0
내 사진을 다른 폴더에 저장하려고하는데 내 mysql db 항목에 속합니다.Uploadify를 통한 동적 Filedestination
코드 :
<?php
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name']; // 1
@session_start();
$_SESSION['recipe_id'] = 5;
if (isset($_SESSION['recipe_id']))
{
$location = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['folder'] . '/'.$_SESSION['recipe_id'] .'/';
if(!is_dir($location))
{
mkdir($location);
}
$targetPath = $location;
include 'db_connect.php';
$sql = "SELECT recipes_id FROM IMAGE WHERE recipes_id="+$_SESSION['recipe_id'];
$result = mysql_query($sql,$db) or exit("QUERY FAILED!");
$anzahl = mysql_num_fields($result);
$anzahl++;
$targetFile = str_replace('//','/',$targetPath) . $anzahl.$_FILES['Filedata']['tmp_name'];
move_uploaded_file($tempFile,$targetFile);
}
else
{
echo "Server Error";
}
}
?>
폴더가 생성되지만 그림이 올바른 폴더에 없습니다.
Uploadify 설정 :
'script' : '/uploadify/uploadify.php',
'uploader' : '/uploadify/uploadify.swf',
'cancelImg' : '/uploadify/cancel.png',
'folder' : '/img/recipes',
'auto' : true
내가 그것을 마지막에 파일 이름을 복용하지 않는 생각