파일 업로드 클래스

class UploadFiles

    {

        function getFile($files, $n=0)

        {

            global $FILE_UPLOAD_DIR;

    

            return $this->getFileA($files, $FILE_UPLOAD_DIR, $n);

        }

 


        function getFileA($files, $dir, $n=0)

        {

            $arr=array();

 

            $fileName = preg_replace("/.[^.]*$/i", "", $files['name']);

            $fileExt = substr(strrchr($files['name'], "."), 1);

            $filePath = $dir."/".$fileName.".".$fileExt;

 

            $cnt = 0;

            while(file_exists($filePath)){

                $filePath = $fileName."[".(++$cnt)."].".$fileExt;

            }

 

            move_uploaded_file($files['tmp_name'][$n], $filePath);

            chmod($filePath, 0777);

 

            $arr['file_name'] = $files['name'][$n];

            $arr['file_ext'] = $fileExt;

            $arr['file_dir'] = $filePath;

            $arr['file_size'] = $files['size'][$n];

            $arr['file_bigo'] = $files['type'][$n];

 

            return $arr;

        }

 

 

        function getFiles($files)

        {

            global $FILE_UPLOAD_DIR;

 

            return $this->getFilesA($files, $FILE_UPLOAD_DIR);

        }

 

 

        function getFilesA($files, $dir)

        {

            $arr = array();

 

            for($i = 0; $i < count($files); $i++)

            {

                $arr[] = $this->getFileA($files, $dir, $i);

            }

 

            return $arr;

        }

    }

|

댓글 1개

class UploadFiles

업로드파일 클래스 정의
댓글을 작성하시려면 로그인이 필요합니다.

자유게시판

+
제목 글쓴이 날짜 조회
18년 전 조회 2,044
18년 전 조회 1,928
18년 전 조회 1,972
18년 전 조회 2,878
18년 전 조회 1,829
18년 전 조회 1,980
18년 전 조회 1,829
18년 전 조회 1,722
18년 전 조회 1,811
18년 전 조회 1,996
18년 전 조회 2,019
18년 전 조회 2,003
18년 전 조회 2,444
18년 전 조회 2,283
18년 전 조회 1,952
18년 전 조회 2,456
18년 전 조회 2,137
18년 전 조회 2,659
18년 전 조회 2,126
18년 전 조회 2,048
18년 전 조회 2,735
18년 전 조회 7,260
18년 전 조회 2,321
18년 전 조회 2,032
18년 전 조회 2,048
18년 전 조회 2,686
18년 전 조회 2,372
18년 전 조회 2,091
18년 전 조회 2,095
18년 전 조회 2,126