Exemplo n.º 1
0
 public function editSettings()
 {
     $id = Utils::getUserID();
     $em = Input::get("emer");
     $emm = Input::get("email");
     $per = Input::get("username");
     if (Input::file('foto')) {
         $file = array('image' => Input::file('foto'));
         // setting up rules
         $rules = array('image' => 'required');
         //mimes:jpeg,bmp,png and for max size max:10000
         // doing the validation, passing post data, rules and the messages
         $validator = Validator::make($file, $rules);
         if ($validator->fails()) {
             // send back to the page with the input data and errors
             //  return Redirect::to('login')->withInput()->withErrors($validator);
             //  print_r("error");
         }
         // else{
         if (Input::file('foto')->isValid()) {
             $destinationPath = 'uploads';
             // upload path
             $extension = Input::file('foto')->getClientOriginalExtension();
             // getting image extension
             $fileName = rand(11111, 99999) . '.' . $extension;
             // renameing image
             Input::file('foto')->move($destinationPath, $fileName);
             // uploading file to given path
         }
         Projects::getProjectsettings($em, $emm, $fileName, $per, $id);
     } else {
         Projects::getProjectsettingsNoPhoto($em, $emm, $per, $id);
     }
     Redirect::to('profile')->send();
 }