Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- if($images['name'][$i] != ''){
- $name = explode('.', $images['name'][$i]);
- $filename = time().rand(1000,9999).'.'.end($name);
- $config = array(
- 'upload_path' => "assets/uploaded/property/",
- 'upload_url' => base_url()."assets/uploaded/property/",
- 'allowed_types' => 'jpeg|jpg|png',
- 'max_size' => '1024',
- 'file_name' => $filename,
- 'overwrite' => FALSE
- );
- $_FILES['image']['name'] = $_FILES['images']['name'][$i];
- $_FILES['image']['type'] = $_FILES['images']['type'][$i];
- $_FILES['image']['tmp_name'] = $_FILES['images']['tmp_name'][$i];
- $_FILES['image']['error'] = $_FILES['images']['error'][$i];
- $_FILES['image']['size'] = $_FILES['images']['size'][$i];
- $this->upload->initialize($config);
- if(!$this->upload->do_upload('image'))
- {
- echo $this->upload->display_errors();
- $data['type'] = 'Error';
- $data['message'] = 'Uploaded file is not a valid image. Only JPG, JPEG and PNG files are allowed.';
- echo json_encode($data);
- exit;
- }else{
- $this->upload->data();
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement