For the http error 500 is done. but i have some problem. Why when i upload a file its not uploaded. And showing "Please check your image!" ?
This is for PHP using a framework Codeigniter
public function submit_image(){
$input_name = $_POST['input_name'];
$input_email = $_POST['input_email'];
$input_code = $_POST['input_code'];
$config['file_name'] = $input_code;
$config['overwrite'] = TRUE;
$config['upload_path'] = './img/';
$config['allowed_types'] = 'gif|jpg|png|jpeg|pdf';
$config['max_size'] = 5000000;
//$config['max_width'] = 6000;
//$config['max_height'] = 4000;
$this->load->library('upload', $config);
$this->upload->initialize($config);
if(!empty($_FILES['filepicture']['name'])){
if ($input_gambar = $this->upload->do_upload('doc')) {
$data = $upload_data = $this->upload->data();
//Compress Image
$config['image_library'] = 'gd2';
$config['source_image'] = './img/'.$data['file_name'];
$config['create_thumb'] = FALSE;
$config['maintain_ratio'] = FALSE;
$config['quality'] = '50%';
$config['width'] = 6000;
$config['height'] = 4000;
$config['new_image'] = './img/resized_'.$data['file_name'];
$this->load->library('image_lib', $config);
if (!$this->image_lib->resize()) {
show_error($this->image_lib->display_errors());
}
echo "<script>alert('Thanks for upload Image');</script>";
echo "<script>window.history.go(-2);</script>";
}else{
echo "<script>alert('Please check your image!');window.history.go(-1);</script>";
}
}
}
Aucun commentaire:
Enregistrer un commentaire