我正在尝试使用codeigniter将文件上传到服务器,但这对我不起作用。但是相同的代码在localhost上工作正常。文件正在上传成功。
请先检查我的代码
public function add_new_book()
{
echo $image = $_FILES ['bookcover']['name'];
$img=$_FILES ['bookcover'];
$config['upload_path'] = 'uploads';
$config['overwrite'] = 'TRUE';
$config["allowed_types"] = 'jpg|jpeg|png|gif|pdf';
$config["max_size"] = '140000';
$config["max_width"] = '1400';
$config["max_height"] = '1400';
$this->load->library('upload', $config);
if(!$this->upload->do_upload('bookfile'))
{
echo "error file";
$this->data['error'] = $this->upload->display_errors();
echo json_encode(array("result"=>$this->data['error']));
exit;
}
if(!$this->upload->do_upload('bookcover'))
{
echo "error file";
$this->data['error'] = $this->upload->display_errors();
echo json_encode(array("result"=>$this->data['error']));
exit;
}
$udata['bookname'] = $this->input->post('bookname');
$udata['author'] = $this->input->post('author');
$udata['Description'] = $this->input->post('description');
$udata['coverImage'] = $_FILES ['bookcover']['name'];
$udata['book'] = $_FILES ['bookfile']['name'];
$udata['createddate'] = date("Y-m-d h:i:sa");
$udata['isavailable'] = '1';
$res = $this->CreateBook_model->insert_books_to_db($udata);
echo json_encode($res);
}
相同的代码在localhost上正常工作,但在控制台中获得500内部服务器错误。
我已经在stackoverflow上查看了与此问题相关的所有问题,但没有任何工作。所以请不要认为它是重复的。帮助已被批准
答案 0 :(得分:-1)
请在您的php.ini文件中检查这些内容,并确保您上传的内容较小,然后在那里给出:
scala> spark.sql("select date_sub(current_timestamp(), 1)").show
+----------------------------------------------+
|date_sub(CAST(current_timestamp() AS DATE), 1)|
+----------------------------------------------+
| 2016-12-12|
+----------------------------------------------+