업로드 디렉토리를 어떻게 바꿀 수 있습니까?Blueimp jQuery 파일 업로드 - 업로드 디렉토리를 변경하는 방법
은 내가 파일 업로드 디렉토리를 변경하려면 동적으로
FG : 각 사용자에 대해, 당신은 $_SESSION
변수 또는 디렉토리를 저장할 수 있습니다 자신의 폴더/그녀에게
감사
업로드 디렉토리를 어떻게 바꿀 수 있습니까?Blueimp jQuery 파일 업로드 - 업로드 디렉토리를 변경하는 방법
은 내가 파일 업로드 디렉토리를 변경하려면 동적으로
FG : 각 사용자에 대해, 당신은 $_SESSION
변수 또는 디렉토리를 저장할 수 있습니다 자신의 폴더/그녀에게
감사
을 파일을 업로드 $_COOKIE
한 다음
$uplDir = $_SESSION["uploadDirectory"].'/;
$option = array(
/* some options */
'upload_dir' => $uplDir,
/* .... */
);
$upload_handler = new UploadHandler($option);
PS /php/index.php 파일에 저장된 값을 가져옵니다.
당신은 JS 파일
<script>
$(function() {
$('#fileupload').fileupload({
dataType: 'json',
formData: [{ name: 'custom_dir', value: '/save/file/here/' }],
done: function (e, data) {
$.each(data.result.files, function (index, file) {
$('<p/>').text(file.name).appendTo(document.body);
});
}
});
});
</script>
//=========================
에서 양식 데이터의 매개 변수를 통해이를 보낼 수있는 시작 부분에 session_start();
을 기억하면서 업로드 핸들러 정의에
require('UploadHandler.php');
$custom_dir = $_SERVER['DOCUMENT_ROOT'] . $_REQUEST['custom_dir'];
$upload_handler = new UploadHandler(array('upload_dir' => $custom_dir));
나는 그것이 더 나은 것 확신 세션에 저장하십시오. 클라이언트 측에서 세션을 조작 할 수 없으므로 경로를 위험한 것으로 변경할 수 없습니다. –