Advertisement
Guest User

Code in controller:

a guest
Sep 6th, 2011
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.85 KB | None | 0 0
  1.     function action_submit()
  2.     {
  3.         if (Input::method() == 'POST') {
  4.         // custom config for this upload
  5.         $config = array(
  6.         'path' => APPPATH.'tmp',
  7.         'randomize' => true,
  8.         'ext_whitelist' => array('jpg', 'jpeg', 'gif', 'png'),
  9.         );
  10.  
  11.     // process the uploaded files in $_FILES
  12.         Upload::process($config);
  13.  
  14.     // if valid files
  15.         if (Upload::is_valid()) {
  16.         // save them according to the config
  17.         Upload::save();
  18.  
  19.         // let's check if we have something normally
  20.         // here u wud call a model method to update
  21.         // the db
  22.         Debug::dump(Upload::get_files());
  23.         } else {
  24.         // process errors
  25.         foreach (Upload::get_errors() as $file) {
  26.         // file is an array with file info
  27.         echo $file['message'];
  28.         }
  29.     }
  30.     }
  31.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement