제가가지고있는 제이쿼리파일업로더안에 upload.php 부분에 파일이 저장될 경로를 입력하는 부분이 있습니다.
아래처렁요..
'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/files/',
그럼 서버의 files 폴더안에 저장되는 형태였습니다.
근데 윗부분에 files 를 지우고, 로그인중인 회원의 ID로 변경하고싶은데
<?=$member['mb_id']?>
$member['mb_id']
해봐도 아무것도 안되네요 ㅜㅜㅜㅜㅜㅈ
제발 도와주세여여영
|
답변 2개 / 댓글 3개
채택된 답변
+20 포인트
2014-09-23 (화) 17:15:43
.'/'.$member['mb_id'].'/', 이렇게 해보세요~
답변에 대한 댓글 3개
xargs
2014-09-24 (수) 09:26:38
답변감사드립니다. 근데.. '/' 여기서 끝나버리는것같아요ㅠㅠㅠ root폴더안에 내용들이보이네여
2014-09-24 (수) 11:04:25
해당 코드 위쪽에 아래처럼 했을때 회원아이디가 나오나요?
echo $member['mb_id'];
echo $member['mb_id'];
2014-09-26 (금) 11:53:24
[code]
<?php
$member = array('mb_id' => 'ddd');
$dd = array(
//'script_url' => $this->get_full_url().'/',
//'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/files/',
//'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/'.$member['mb_id'].'/',
'upload_dir' => '/'.$member['mb_id'].'/',
//'upload_url' => $this->get_full_url().'/files/',
'user_dirs' => false,
'mkdir_mode' => 0777,
'param_name' => 'files'
);
var_dump($dd);
?>
[/code]
위에처럼 해보니 정상출력은 되는데요.. 어디가 문제인지 저도 잘 모르겠네요.
잘 해결하시길 바랍니다.
<?php
$member = array('mb_id' => 'ddd');
$dd = array(
//'script_url' => $this->get_full_url().'/',
//'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/files/',
//'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/'.$member['mb_id'].'/',
'upload_dir' => '/'.$member['mb_id'].'/',
//'upload_url' => $this->get_full_url().'/files/',
'user_dirs' => false,
'mkdir_mode' => 0777,
'param_name' => 'files'
);
var_dump($dd);
?>
[/code]
위에처럼 해보니 정상출력은 되는데요.. 어디가 문제인지 저도 잘 모르겠네요.
잘 해결하시길 바랍니다.
xargs
2014-09-26 (금) 01:18:04
Copy
<?php ),?><?class UploadHandler{ protected $options; // PHP File Upload error message codes: // http://php.net/manual/en/features.file-upload.errors.php protected $error_messages = array( 1 => 'The uploaded file exceeds the upload_max_filesize directive in php.ini', 2 => 'The uploaded file exceeds the MAX_FILE_SIZE directive that was specified in the HTML form', 3 => 'The uploaded file was only partially uploaded', 4 => 'No file was uploaded', 6 => 'Missing a temporary folder', 7 => 'Failed to write file to disk', 8 => 'A PHP extension stopped the file upload', 'post_max_size' => 'The uploaded file exceeds the post_max_size directive in php.ini', 'max_file_size' => 'File is too big', 'min_file_size' => 'File is too small', 'accept_file_types' => 'Filetype not allowed', 'max_number_of_files' => 'Maximum number of files exceeded', 'max_width' => 'Image exceeds maximum width', 'min_width' => 'Image requires a minimum width', 'max_height' => 'Image exceeds maximum height', 'min_height' => 'Image requires a minimum height' ); protected $image_objects = array(); function __construct($options = null, $initialize = true, $error_messages = null) { //alert(get_full_url()); $this->options = array( 'script_url' => $this->get_full_url().'/', 'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/files/', //'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/'.$member['mb_id'].'/', 'upload_url' => $this->get_full_url().'/files/', 'user_dirs' => false, 'mkdir_mode' => 0777, 'param_name' => 'files', // Set the following option to 'POST', if your server does not support // DELETE requests. This is a parameter sent to the client: 'delete_type' => 'POST', 'access_control_allow_origin' => '*', 'access_control_allow_credentials' => false, 'access_control_allow_methods' => array( 'OPTIONS', 'HEAD', 'GET', 'POST', 'PUT', 'PATCH', 'DELETE' ), 'access_control_allow_headers' => array( 'Content-Type', 'Content-Range', 'Content-Disposition' ),
답변을 작성하려면 로그인이 필요합니다.