【发布时间】:2013-05-04 17:05:52
【问题描述】:
我有一个大表单,允许用户将多个文件/文件类型上传到他们正在创建的报价/出价。一切正常,除了一件:保存到数据库之前文件的名称加密。
我还没有找到它的韵律或原因,但它是命中注定的。图像每次都能正常工作。其他文档(允许所有 [*] 类型,但主要包含各种业务文档,例如 pdf、doc、xls 等)是参差不齐的。
我在 SO 和其他地方发现了有关名称加密的一般问题的线程,但还没有遇到一个处理我的问题的特殊性的线程。
上传功能如下:
//for multi uploads
function do_uploads($name, $file)
{
$status ="";
$msg = "";
$file_element_name = $name;
//go through and figure out where it goes
if($name == "QuoteDoc") {
$folder = "quotedocs";
$allowed = '*';
}
else if($name == "ProductOfferPhoto") {
$folder = "product_photos";
$allowed = 'jpeg|jpg|png|gif';
}
else if($name == "ResearchWhtPaper1" || $name == "ResearchWhtPaper2") {
$folder = "research";
$allowed = "*";
}
else if($name == "ProductLiterature1" || $name == "ProductLiterature2") {
$folder = "literature";
$allowed = "*";
}
else if ($name == "FDALink") {
$folder = "fda";
$allowed = "*";
}
$config['upload_path'] = './uploads/' . $folder;
$config['allowed_types'] = $allowed;
$config['max_size'] = 1024 * 8;
$config['encrypt_name'] = TRUE;
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload($name))
{
$status = 'error';
$msg = $this->upload->display_errors('', '');
}
else {
$data = $this->upload->data();
}
@unlink($_FILES[$file_element_name]);
//what's up?
//return $this->upload->data();
return array('status' => $status, 'msg' => $msg, 'data' => $this->upload->data(), 'allowed'=>$allowed);
}
任何帮助将不胜感激。
【问题讨论】:
-
那么你得到什么文件名?原版?
-
抱歉,问题是上传过程中哪些文件名没有加密,在
$this->upload->data()?
标签: php codeigniter file-upload