我正在将 CodeIgniter 用于我拥有的 iPhone 应用程序。该应用程序允许用户将图像分享给特定的个人。效果很好,但似乎在将一定数量的图片发送给个人后,帖子无法上传。我想知道 CodeIgniter 中是否有什么东西导致了这个问题以及如何解决它。
这是我们的配置文件的一部分:
$config['proxy_ips'] = '';
$config['upload_group_path'] = "./upload/group";
$config['upload_user_path'] = "./upload/users";
$config['upload_photo_path'] = "./upload/photo";
$config['upload_video_path'] = "./upload/video";
$config['upload_weblink_path'] = "./upload/weblink";
$config['upload_drawing_path'] = "./upload/drawing";
$config['upload_text_path'] = "./upload/text";
$config['upload_movietype'] = 'mp4|flv|3gp|wmv';
$config['upload_moviesize'] = 100 * 1024; // 100M
$config['upload_alltype'] = '*';
$config['upload_allsize'] = 100 * 1024; // 100M
$config['upload_imgtype'] = 'gif|jpg|png|bmp|jpeg|jpe';
$config['upload_imgsize'] = 5 * 1024; // 5M
$config['upload_thumb_mw'] = '80';
$config['upload_thumb_mh'] = '60';
$config['upload_kmltype'] = 'kml';
$config['upload_kmlsize'] = 10 * 1024; // 10M
$config['main_category'] = array(
'user' => 'Users',
'photo' => 'Photos',
);
$config['difficulty'] = array(
'Easy' => 'Easy',
'Moderate' => 'Moderate',
'Difficult' => 'Difficult',
);
$config['max_count_per_page'] = 5;
$config['thumb_name'] = "_thumb";
$config['photo_name'] = "_photo";
以及我们的 api 文件的一部分(在 xcode 的输出中绘制错误“上传失败”):
$tbl_name = "posts";
$new_idx = $this->api_m->get_next_insert_idx($tbl_name);
if (isset($_FILES['datafile']) && $_FILES['datafile']['name'] != '') {
$conf = array();
$conf['upload_path'] = $this->api_m->get_upload_path($postType, $ownerID."_".$format);
$conf['allowed_types'] = $this->config->item('upload_alltype');
$conf['max_size'] = $this->config->item('upload_allsize');
$conf['overwrite'] = FALSE;
$conf['remove_spaces'] = TRUE;
if (!file_exists($conf['upload_path'])) {
mkdir($conf['upload_path']);
}
$this->upload->initialize($conf);
if ($this->upload->do_upload('datafile')) {
$fileinfo = $this->upload->data();
if ($fileinfo['file_size'] > 0) {
$postURL = base_url().substr($conf['upload_path'], 2)."/".$fileinfo['file_name'];
if ($postType == "video") {
$referenceData = base_url().substr($conf['upload_path'], 2)."/".$fileinfo['file_name'];
if (isset($_FILES['thumbfile']) && $_FILES['thumbfile']['name'] != '') {
$conf = array();
$conf['upload_path'] = $this->api_m->get_upload_path($postType, $ownerID."_".$format);
$conf['allowed_types'] = $this->config->item('upload_alltype');
$conf['max_size'] = $this->config->item('upload_allsize');
$conf['overwrite'] = FALSE;
$conf['remove_spaces'] = TRUE;
if (!file_exists($conf['upload_path'])) {
mkdir($conf['upload_path']);
}
$this->upload->initialize($conf);
if ($this->upload->do_upload('thumbfile')) {
$fileinfo = $this->upload->data();
$baseName = $this->api_m->_img_resize($postType, $fileinfo, $fileinfo['raw_name'], $new_idx);
$postURL = base_url().substr($conf['upload_path'], 2)."/".$baseName;
$baseName = $this->api_m->_img_thumb($postType, $fileinfo, $fileinfo['raw_name'], $new_idx);
$thumbURL = base_url().substr($conf['upload_path'], 2)."/".$baseName;
}
}
} else {
$baseName = $this->api_m->_img_thumb($postType, $fileinfo, $fileinfo['raw_name'], $new_idx);
$thumbURL = base_url().substr($conf['upload_path'], 2)."/".$baseName;
}
$uploadMsg = "success";
}
} else {
$uploadMsg = "fail to upload";
}
} else {
$uploadMsg = "select the post data";
}