Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php if (!defined('BASEPATH')) exit('No direct script access allowed');
- class uploadfile extends CI_Controller {
- function __construct() {
- parent::__construct();
- $this->load->helper(array('form', 'url'));
- $this->load->library('upload');
- }
- function index() {
- $this->load->view('uploadfile');
- }
- function do_upload() {
- $config = array(
- 'upload_path' => './resources/uploads'
- , 'allowed_types' => 'gif|jpg|png'
- , 'max_size' => '1000000000'
- , 'max_width' => '2048'
- , 'max_height' => '1024'
- );
- $this->upload->initialize($config);
- $pic = '';
- if (isset($_FILES["userfile"]["name"])) {
- if (!$this->upload->do_upload()) {
- } else {
- $tGambar = $this->upload->data();
- $pic = $tGambar["file_name"];
- }
- } else {
- $pic = '';
- }
- print_r($pic);
- }
- }
- ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement