脚本宝典收集整理的这篇文章主要介绍了PHP Codeigniter上传类,重命名具有特定架构的文件,脚本宝典觉得挺不错的,现在分享给大家,也给大家做个参考。
我的问题是在上传图片时,你可以处理好一些类型.那么如何使用file_name配置选项将文件名更改为特定模式(我已经将模式部分启动并运行).但保持相同的文件类型?
现在我正在尝试
$upload_config [‘file_name’] = $generated_filename_From_schema
唯一的问题是$generated_filename_from_schema没有文件扩展名,并且将文件扩展名保留在等式CI之外似乎完全忽略它并且只是获取文件并且apPEnd_1,_2,_3如果文件具有相同的名称则上升,否则它只是保留了名称.
现在我必须将$config传递给CI,以便上传文件,但是如何在上传之前确定我正在使用哪种文件,这样我就可以使用我的名字生成模式.
*编辑*
$upload_config['upload_path'] = realpath(APPPATH.'../images/'); $upload_config['Allowed_types'] = 'gif|jpg|png'; $upload_config['max_size'] = 0; $upload_config['max_width'] = 0; $upload_config['max_height'] = 0; $upload_config['remove_spaces'] = true; $upload_config['file_name'] = $this->genfunc->genFileName($uid); if($this->input->post('uploads')) { $this->load->library('upload'); $this->upload->initialize($upload_config); if (!$this->upload->do_upload()) { //echo 'error'; echo $config['upload_path']; $this->data['errors'] = $this->upload->display_errors(); } else { //echo 'uploaded'; $this->data['upload_data'] = $this->upload->data(); } }
以上是脚本宝典为你收集整理的PHP Codeigniter上传类,重命名具有特定架构的文件全部内容,希望文章能够帮你解决PHP Codeigniter上传类,重命名具有特定架构的文件所遇到的问题。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。