Php swf文件未在codeigniter中上载
列出的其他文件正在上载,但swf文件未上载,不支持提供文件类型错误 这是我的控制器Php swf文件未在codeigniter中上载,php,codeigniter,file-upload,flash,Php,Codeigniter,File Upload,Flash,列出的其他文件正在上载,但swf文件未上载,不支持提供文件类型错误 这是我的控制器 function do_upload(){ $pid=$this->input->post('Page_id'); $config['upload_path'] = './uploads/'; $config['allowed_types'] = 'swf|png|gif|jpg'; $config['max_size'] = '1048'; $config['
function do_upload(){
$pid=$this->input->post('Page_id');
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'swf|png|gif|jpg';
$config['max_size'] = '1048';
$config['file_name'] =$pid;
$this->load->library('upload', $config);
if ( ! $this->upload->do_upload())
{
$error = array('error' => $this->upload->display_errors());
$this->load->view('admin/upload', $error);
}
else
{
$data = array('upload_data' => $this->upload->data());
$this->upload_success();
}
}
可能是_File_mime_type函数中的File Upload类存在错误
查找更多信息
您还没有通过do\u upload
调用中的字段名
$config = array(
'allowed_types' => 'jpg|jpeg|swf|png', // pipe seperated file types
'upload_path' => './uploads/',// should be the root path
'max_size' => '1048',
'file_name' =>$pid
);
$this->load->library('upload', $config );
if (!$this->upload->do_upload('your_field_name')){
// like $this->upload->do_upload($pid)
$error = array('error' => $this->upload->display_errors());
}else{
$swf_data = $this->upload->data();
}
希望它有意义您确定创建的表单正确吗-多部分
侧注:do_upload()
确实接受参数,但它是必需的。默认值是userfile。我尝试了,但它再次显示一个错误,您尝试上载的文件类型是不允许的。您确定您的文件类型是。swf
其中没有空格我编辑了我的答案有空格我在1058行号上检查了它与正确的相似format@RahatIslamKhan查看函数引用在函数referenceellisab.com/codeigniter/user-guide/libraries/file_upload.html中,您应该提供字段名。