如何获取上传的文件在codeigniter的完整路径? [英] How to get full path of the uploaded file in codeigniter?
问题描述
我正在使用codeIgniter文件上传类示例 http://ellislab.com/codeigniter/ user_guide / libraries / file_uploading.html 上传文件。在上传文件后的示例中,它将在上传成功视图页面中显示如下所示的详细信息。
I am using codeIgniter file uploading class example http://ellislab.com/codeigniter/user_guide/libraries/file_uploading.html to upload files. In the example after i uploaded files it will show details like below in the upload success view page.
Array
(
[upload_data] => Array
(
[file_name] => VenkataKrishna10.pdf
[file_type] => application/pdf
[file_path] => C:/xampp/htdocs/upload/application/
[full_path] => C:/xampp/htdocs/upload/application/VenkataKrishna10.pdf
[raw_name] => VenkataKrishna10
[orig_name] => VenkataKrishna.pdf
[client_name] => VenkataKrishna.pdf
[file_ext] => .pdf
[file_size] => 83.27
[is_image] =>
[image_width] =>
[image_height] =>
[image_type] =>
[image_size_str] =>
)
)
之后,我尝试查看数组格式。我的问题是如何从上面的数组获取完整的文件路径。我知道有一个变量 full_path
但我不能得到它。请帮助我。
Afterwards I tried to see entire uploaded data in an array format. My question is how to get full file path from the above array. I know there is a variable full_path
but I am not able to get it. Please help me.
推荐答案
从您的控制器使用
echo $data['upload_data']['full_path'];
从您的视图中使用
echo $upload_data['full_path'];
这篇关于如何获取上传的文件在codeigniter的完整路径?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!