간단한 질문인데 답변 부탁드립니다.

간단한 질문인데 답변 부탁드립니다.

QA

간단한 질문인데 답변 부탁드립니다.

본문

            
                                             

     

제가가지고있는 제이쿼리파일업로더안에 upload.php 부분에 파일이 저장될 경로를 입력하는 부분이 있습니다.

아래처렁요..

 

     'upload_dir' => dirname($this->get_server_var('SCRIPT_FILENAME')).'/files/',

 

그럼 서버의 files 폴더안에 저장되는 형태였습니다. 

 

근데 윗부분에 files 를 지우고, 로그인중인 회원의 ID로 변경하고싶은데

 

<?=$member['mb_id']?>

$member['mb_id']

해봐도 아무것도 안되네요 ㅜㅜㅜㅜㅜㅈ

제발 도와주세여여영 

 

이 질문에 댓글 쓰기 :

답변 2

​.'/'.​$member['mb_id'].'/', 이렇게 해보세요~


<?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);
?>


위에처럼 해보니 정상출력은 되는데요.. 어디가 문제인지 저도 잘 모르겠네요.
잘 해결하시길 바랍니다.


<?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'
            ),​
 
 

 

답변을 작성하시기 전에 로그인 해주세요.
전체 59,882
QA 내용 검색

회원로그인

(주)에스아이알소프트 / 대표:홍석명 / (06211) 서울특별시 강남구 역삼동 707-34 한신인터밸리24 서관 1404호 / E-Mail: admin@sir.kr
사업자등록번호: 217-81-36347 / 통신판매업신고번호:2014-서울강남-02098호 / 개인정보보호책임자:김민섭(minsup@sir.kr)
© SIRSOFT