使用codeigniter在$ config ['encrypt_name']之后获取文件名 [英] get file name after $config['encrypt_name'] using codeigniter
问题描述
反正我有加密文件后要获取文件的文件名,以便我可以将文件名保存到数据库中的情况。
Is there anyway for me to get the file_name of the file after it was encrypted so that i can save the filename to my database.
$config['encrypt_name'] = TRUE;
此加密通常会更改图像文件的文件名。我想知道如何获取它或将其保存到变量中。
this encrypt is generally change the file name of the image file. I wonder how can I get it or probably save it to a variable. Thanks in advance.
推荐答案
$ this-> upload-> data();
$this->upload->data();
这是一个辅助函数,它返回一个数组,其中包含与您上载的文件有关的所有数据。这是数组原型:
This is a helper function that returns an array containing all of the data related to the file you uploaded. Here is the array prototype:
Array
(
[file_name] => mypic.jpg
[file_type] => image/jpeg
[file_path] => /path/to/your/upload/
[full_path] => /path/to/your/upload/jpg.jpg
[raw_name] => mypic
[orig_name] => mypic.jpg
[client_name] => mypic.jpg
[file_ext] => .jpg
[file_size] => 22.2
[is_image] => 1
[image_width] => 800
[image_height] => 600
[image_type] => jpeg
[image_size_str] => width="800" height="200"
)
,所以您可以访问$ uploaded = $ this-> upload-> data();
$ uploaded ['file_name'] ...等等
so you can acces like $uploaded=$this->upload->data(); $uploaded['file_name']... etc
https://www.codeigniter.com/user_guide/libraries/file_uploading.html
这篇关于使用codeigniter在$ config ['encrypt_name']之后获取文件名的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!