I created a form in CodeIgniter framework that successfully uploads an image using the tutorial in the CodeIgniter manual ( http://codeigniter.com/user_guide/libraries/file_uploading.html ), but when I try to grab the file name, the following code is simply returning 'resize/user/w'. Any thoughts are appreciated!
$type = 'user';
$imageData = $this->upload->data();
foreach ($imageData as $info) {
$url = 'resize/' . $type . '/' . $info['file_name'];
}
echo $url;
print_r($imageData);
will display all the useful upload data from the CI Upload Class :
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"
)
You can reference the the properties you want directly as Cosmin Atanasiu said with $imageData['file_name']
, etc.
尝试使用:
echo $imageData["file_name"];
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.