| 제목 | codeingter 파일 암호화 복호화 encrypt , decrypt | ||
|---|---|---|---|
| 글쓴이 | ci세상 | 작성시각 | 2015/02/27 14:08:51 |
|
|
|||
|
codeingter 파일 암호화 복호화 encrypt , decrypt 참고문서 : http://stackoverflow.com/questions/11716047/how-to-encrypt-decrypt-files-with-php-mcrypt To encode after upload:
// using codeigniter's encryption library, which uses mcrypt and the AES cypher
$this->load->library('encrypt');
$pathandname = $config['upload_path'].$output['content'][$a]['file_name'];
$theFile = file_get_contents($pathandname);
$fh = fopen($pathandname,'w');
fwrite($fh,$this->encrypt->encode($theFile));
fclose($fh);
To decode & download:
$this->load->library('encrypt');
$pathandname = $filelocation.$results[0]['encryptedfile'];
$theFile = file_get_contents($pathandname);
$decrypted = $this->encrypt->decode($theFile);
force_download($filename, $decrypted); // a codeigniter function to force download via headers
|
|||
| 다음글 | T-SQL Base64 Encoding, Decodin... (1) | ||
| 이전글 | CI3.0 RC2 를 어제부터 처음 시작했는데 다수개의... (2) | ||
|
한대승(불의회상)
/
2015/02/27 16:25:35 /
추천
0
좋은 정보 감사 합니다.
|