0

I use "File Uploading Class" of CodeIgniter to upload files; my problem is later on I'm using the uploaded image name and although I already used the following code to give the meaning full name, Users may have already saved the same name and the new file will be like "John1","John2", "John3",...

        ...
        $config['file_name'] = $this->input->post("employeeName");
        $this->load->library('upload', $config);

Is there any way to figure out the real name which was used to save the file with the added extensions?

I hope my questions is clear, but if you need more clarification, please just let me know which part you need more clarification.

Thanks

4

1 回答 1

2

$this->upload->data()上传文件后,将返回一个包含文件所有内容的 assoc 数组:

样本输出:

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"
)

此处的完整文档:http: //ellislab.com/codeigniter/user-guide/libraries/file_uploading.html

于 2013-10-22T19:57:34.367 回答