請教一個圖片上傳的問題
請問CI 圖片上傳後的檔案名稱 ,是否可以自行訂義檔名呢?謝謝! {:1_1:} 重名了呢? yunnysunny 发表于 2012-6-18 11:41 static/image/common/back.gif
重名了呢?
你好 , 我想以 "帳號+日期" 自行定義檔名{:1_1:} 本帖最后由 niudongwei 于 2012-6-18 16:02 编辑
http://codeigniter.com/user_guide/libraries/file_uploading.html
file_nameNoneDesired file nameIf set CodeIgniter will rename the uploaded file to this name. The extension provided in the file name must also be an allowed file type.
niudongwei 发表于 2012-6-18 15:55 static/image/common/back.gif
http://codeigniter.com/user_guide/libraries/file_uploading.html
你好 ,file_name 似乎不允許變量命名 ,只能指定固定的常量值:L 肯定可以啦,如果重名,后边加参数 linlong3388 发表于 2012-6-19 08:33 static/image/common/back.gif
你好 ,file_name 似乎不允許變量命名 ,只能指定固定的常量值
$config = array(
'upload_path' => 'e:/web/root/',
'allowed_types' => 'jpg|jpeg|png|gif',
'max_size' => 3072,
'encrypt_name' => false
);
$config['file_name'] = time().'file';
$this->load->library('upload', $config); linlong3388 发表于 2012-6-19 08:33 static/image/common/back.gif
你好 ,file_name 似乎不允許變量命名 ,只能指定固定的常量值
当然可以用变量的
$config = array(
'upload_path' => 'e:/web/root/',
'allowed_types' => 'jpg|jpeg|png|gif',
'max_size' => 3072,
'encrypt_name' => false
);
$config['file_name'] = time().'file';
$this->load->library('upload', $config);
页:
[1]