当前位置: 首页>>代码示例>>PHP>>正文


PHP Input::hasfile方法代码示例

本文整理汇总了PHP中Input::hasfile方法的典型用法代码示例。如果您正苦于以下问题:PHP Input::hasfile方法的具体用法?PHP Input::hasfile怎么用?PHP Input::hasfile使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Input的用法示例。


在下文中一共展示了Input::hasfile方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: submit_photo

 public function submit_photo()
 {
     $dataPost = file_get_contents("php://input");
     $dataPost = json_decode($dataPost, true);
     if (!$dataPost) {
         $dataPost = $_POST;
     }
     $dataFiles = $_FILES;
     App::setLocale('vi');
     $rules = array('file' => 'required|mimes:jpeg,gif,png|max:2000', 'title' => 'required|max:100|min:10', 'tags' => 'max:20', 'source' => 'max:100|min:5');
     $validator = Validator::make(Input::all(), $rules);
     // check if the validator failed -----------------------
     if ($validator->fails()) {
         // get the error messages from the validator
         $messages = $validator->messages();
         // redirect our user back to the form with the errors from the validator
         return Redirect::to('/upload-photo')->withErrors($validator);
     } else {
         $destinationPath = 'uploads/photos';
         if (!file_exists($destinationPath)) {
             mkdir($destinationPath, 0777);
         }
         if (Input::hasfile('file') && Input::file('file')->isValid()) {
             $upload_success = Input::file('file')->move($destinationPath, Input::file('file')->getclienToriginalName());
         }
         $photo = array('title' => ucfirst(Input::get('title')), 'creation_date' => date("Y-m-d H:i:s"), 'modified_date' => date("Y-m-d H:i:s"), 'user_id' => Auth::user()->id, 'status' => 1, 'is_home' => 1, 'photo_view_count' => '', 'photo_comment_count' => '', 'source' => Input::get('source'), 'sensitive_content' => Input::get('sensitive_content'));
         $photo_id = DB::table('photos')->insertGetId($photo);
         $file = array('parent_type' => 'photo', 'parent_id' => $photo_id, 'user_id' => Auth::user()->id, 'creation_date' => date("Y-m-d H:i:s"), 'modified_date' => date("Y-m-d H:i:s"), 'storage_path' => 'uploads/photos/' . Input::file('file')->getClientOriginalName(), 'extension' => Input::file('file')->getClientMimeType(), 'name' => Input::file('file')->getClientOriginalName(), 'mime_major' => 'image', 'mime_minor' => Input::file('file')->getClientMimeType());
         DB::table('files')->insert($file);
         $this->update_tags(Input::get('tags'), $photo_id, 'photo');
         echo json_encode(array('success' => true));
     }
 }
开发者ID:moonlight87,项目名称:laravel,代码行数:33,代码来源:UserController.php

示例2: store

 /**
  * Store a newly created resource in storage.
  *
  * @return Response
  */
 public function store()
 {
     $post = new postadmin();
     $post->id = Input::get('id');
     $post->judul = Input::get('judul');
     $post->isi = Input::get('isi');
     if (Input::hasfile('foto')) {
         $foto = date("YmdHis") . uniqid() . "." . Input::file('foto')->getClientOriginalExtension();
         Input::file('foto')->move(storage_path(), $foto);
         $post->foto = $foto;
     }
     $post->save();
     return redirect(url('admin.add'));
 }
开发者ID:syahrulrzq,项目名称:bekod-1,代码行数:19,代码来源:AdminController.php

示例3: postUpdate

 /**
  * Update the specified resource in storage.
  *
  * @param  int  $id
  * @return Response
  */
 public function postUpdate()
 {
     $input = Input::all();
     $input_array = (array) $input;
     $input_array['active'] = $input_array['active'] == 'true' || $input_array['active'] == 1;
     $doc_root = $_SERVER["DOCUMENT_ROOT"];
     if (Input::hasfile('file')) {
         $file = Input::file('file');
         $band = unlink($doc_root . "/" . $input_array['main_image']);
         $vector = explode("/banners/", $input_array['main_image']);
         $file->move($doc_root . "/photos/banners", $vector[1]);
     }
     return Flag::updateFlag($input_array);
 }
开发者ID:giovanimora0527,项目名称:sigeri,代码行数:20,代码来源:FlagController.php

示例4: store

 public function store()
 {
     if (Input::hasfile('thumbnail')) {
         $files = Input::file('thumbnail');
         foreach ($files as $file) {
             $name = time() . '-' . $file->getClientOriginalName();
             $file = $file->move(public_path() . '/uploadedImgs/', $name);
             $post = new Post();
             $post->title = Input::get('title');
             $post->body = Input::get('body');
             $post->thumbnail = $name;
             $post->save();
         }
         return "done";
     }
 }
开发者ID:dannywng,项目名称:mypic,代码行数:16,代码来源:PostsController.php

示例5: store

 /**
  * Store a newly created resource in storage.
  *
  * @param  Request  $request
  * @return Response
  */
 public function store(Request $request)
 {
     //
     $this->validate($request, ['သီခ်င္းေခါင္းစဥ္' => 'required|max:1000', 'image' => 'required|mimes:jpeg,png,jpg', 'singer' => 'required|max:255', 'content' => 'required']);
     $singlemusic = new SingleMusic();
     $singlemusic->title = $request->input('သီခ်င္းေခါင္းစဥ္');
     $singlemusic->image = $request->input('photo');
     $singlemusic->singer = $request->input('singer');
     $singlemusic->mtv = $request->input('mtv');
     $mp3path = public_path() . '/upload/mp3';
     if (\Input::hasfile('mp3')) {
         if (\Input::file('mp3')->getClientOriginalExtension() != "mp3") {
             $error = array();
             $error[] = "File type must be mp3";
             $validator = $error;
             return redirect()->route('music.create')->withInput()->withErrors($validator);
         } else {
             $mp3name = \Input::file('mp3')->getClientOriginalname();
             $mp3rename = str_random(20);
             \Input::file('mp3')->move($mp3path, $mp3rename);
             $uploadedfile = Storage::get($mp3rename);
             Storage::disk('s3')->put($mp3name, $uploadedfile);
             \File::delete(public_path() . "/upload/mp3/" . $mp3rename);
             $singlemusic->mp3 = "https://s3-us-west-2.amazonaws.com/myanmarmusicart/" . $mp3name;
         }
     }
     $imagepath = public_path() . '/upload/image';
     $imagename = \Input::file('image')->getClientOriginalExtension();
     $imgrename = str_random(20);
     $imgFileName = $imgrename . "." . $imagename;
     \Input::file('image')->move($imagepath, $imgrename . "." . $imagename);
     $singlemusic->language = $request->input('language');
     $singlemusic->categories = $request->input('categories');
     $singlemusic->content = $request->input('content');
     $singlemusic->author = Auth::user()->nickname;
     $singlemusic->image = asset('/upload/image/' . $imgrename . "." . $imagename);
     $singlemusic->imageName = $imgFileName;
     $singlemusic->save();
     return redirect()->route('music.index');
 }
开发者ID:phyochan,项目名称:fan-mma,代码行数:46,代码来源:SingleController.php

示例6: update

 /**
  * Update the specified resource in storage.
  *
  * @param  \Illuminate\Http\Request  $request
  * @param  int  $id
  * @return \Illuminate\Http\Response
  */
 public function update(Requests\ProfileUpdateFormRequest $request, $id)
 {
     //validate the inputes
     //check if the user can update
     $profile = Profile::findOrFail($id);
     //Get all inputes
     $name = $profile->user->id . '_profile_pic';
     if (\Input::hasfile('profile_pic')) {
         $extention = \Input::file('profile_pic')->getClientOriginalExtension();
         $filename = $name . '.' . $extention;
         $destination_path = 'storage/users/' . $profile->user->id . '/profilepic';
         $profile_pic_path = '/' . $destination_path . '/' . $filename;
         $isuploaded = \Input::file('profile_pic')->move($destination_path, $filename);
     } else {
         $filename = $profile->profile_pic;
     }
     //update profile
     $profile->fill(['profile_pic' => $profile_pic_path, 'bio' => $request->bio, 'region' => $request->region, 'school' => $request->school, 'division' => $request->division, 'stream' => $request->stream])->save();
     //redirect user to profile show route
     $message = "You have successfully update your profile";
     return \Redirect::route('user.profile.show', \Auth::user()->id)->with('success', $message);
 }
开发者ID:greenzemg,项目名称:menelik,代码行数:29,代码来源:ProfileController.php

示例7: store

 public function store()
 {
     if (Sentry::check()) {
         $ued = Sentry::getUser()->id;
     }
     $city = Sentry::getuser()->city;
     $product = new Product();
     $product->user_id = $ued;
     $product->metal = Input::get('metal');
     $product->supplier = Input::get('supplier');
     $product->grade_a = Input::get('grade_a');
     $product->grade_b = Input::get('grade_b');
     $product->shape = Input::get('shape');
     $product->size_a = Input::get('size_a');
     $product->size_b = Input::get('size_b');
     $product->size_c = Input::get('size_c');
     $product->thickness = Input::get('thickness');
     $product->volume = Input::get('volume');
     $product->bynumber = Input::get('bynumber');
     $product->perday = Input::get('perday');
     $product->city = $city;
     if ($image = Input::file('images')) {
         $filename = date('Y-m-d-H:i:s') . "-" . rand(1, 100);
         Image::make($image->getRealPath())->resize(488, 370)->save('public/images/' . $filename);
         $product->images = 'images/' . $filename;
     } else {
         $product->images = 'images/default.jpg';
     }
     $cadfilename = date('Y-m-d-H:i:s') . "-" . rand(1, 100);
     if (Input::hasfile('files')) {
         Input::file('files')->move('public/img/', $cadfilename);
         $product->files = 'img/' . $cadfilename;
     } else {
         $product->files = '0';
     }
     $product->save();
     return Redirect::to('/list')->with('flash_notice', 'Product added successfully');
 }
开发者ID:ArbindJain,项目名称:scrapkart,代码行数:38,代码来源:ProductsController.php

示例8: send

 public function send()
 {
     $rules = array('name' => 'required', 'songname' => 'required', 'singer' => 'required', 'email' => 'required|email', 'image' => 'required|mimes:jpeg,png,jpg');
     $validator = Validator::make(\Input::all(), $rules);
     if ($validator->fails()) {
         return \Redirect::to('/ug/send')->withErrors($validator)->withInput();
     } else {
         if (\Input::hasfile('mp3')) {
             if (\Input::file('mp3')->getClientOriginalExtension() != "mp3") {
                 $error = array();
                 $error[] = "File type must be mp3";
                 $validator = $error;
                 return \Redirect::to('/ug/send')->withInput()->withErrors($validator);
             } else {
                 $mp3path = public_path() . '/upload/send/mp3';
                 $mp3name = \Input::file('mp3')->getClientOriginalname();
                 \Input::file('mp3')->move($mp3path, $mp3name);
                 $imagepath = public_path() . '/upload/send/image';
                 $imagename = \Input::file('image')->getClientOriginalExtension();
                 $imgrename = str_random(20);
                 $imgFileName = $imgrename . "." . $imagename;
                 \Input::file('image')->move($imagepath, $imgrename . "." . $imagename);
                 $send = new Sends();
                 $send->name = \Input::get('name');
                 $send->songname = \Input::get('songname');
                 $send->singer = \Input::get('singer');
                 $send->email = \Input::get('email');
                 $send->mp3 = asset('upload/send/mp3/' . $mp3name);
                 $send->image = asset('upload/send/image/' . $imgFileName);
                 $send->mp3filename = $mp3name;
                 $send->imagefilename = $imgFileName;
                 $send->save();
                 \Flash::overlay('Please Wait! While We Finish Upload in Myanmar Music Art.', "Thank you for your music");
                 return \Redirect::to('/ug/send');
             }
         }
     }
 }
开发者ID:phyochan,项目名称:fan-mma,代码行数:38,代码来源:SendController.php

示例9: add_banner

 public function add_banner()
 {
     try {
         $banner_title = Input::get("banner_title");
         $banner_description = Input::get("banner_description");
         $banner_order = Input::get("banner_order");
         $destinationPath_Banner = 'asserts/images/Banner';
         $banner_images = null;
         if (Input::hasfile("file")) {
             $file_Banner = Input::file("file");
             $banner_images = $file_Banner->getClientOriginalName();
             $upload_success_banner = $file_Banner->move($destinationPath_Banner, $banner_images);
         }
         $_banner = new Banner();
         $_banner->banner_title = $banner_title;
         $_banner->banner_description = $banner_description;
         $_banner->banner_images = $banner_images;
         $_banner->banner_order = $banner_order;
         $_banner->save();
     } catch (Exception $_ex) {
         Session::flash('error', '$$$ --- Error Banner -' . $banner_title . '(' . $_ex->getMessage() . ') --- $$$');
     }
     Session::flash('success', '$$$ --- Add - ' . $banner_title . ' Successfully  --- $$$');
     return Redirect::to('qlm-admin/add-new-banner');
 }
开发者ID:ndmson,项目名称:QLM,代码行数:25,代码来源:AdminController.php

示例10: update

 /**
  * Update the specified resource in storage.
  *
  * @param  Request  $request
  * @param  int  $id
  * @return Response
  */
 public function update(Request $request, $id)
 {
     //
     $this->validate($request, ['songname' => 'required|max:1000', 'singer' => 'required|max:255', 'content' => 'required']);
     $singlemusic = SingleMusic::findOrNew($id);
     if (\Input::hasfile('photo')) {
         $imagepath = public_path() . '/upload/image';
         $imagename = \Input::file('photo')->getClientOriginalExtension();
         $imgrename = str_random(20);
         $singlemusic->image = asset('/upload/image/' . $imgrename . "." . $imagename);
         $imgFileName = $imgrename . "." . $imagename;
         \Input::file('photo')->move($imagepath, $imgrename . "." . $imagename);
         $singlemusic->imageName = $imgFileName;
     }
     if (\Input::hasfile('mp3')) {
         if (\Input::file('mp3')->getClientOriginalExtension() != "mp3") {
             $error = array();
             $error[] = "File type must be mp3";
             $validator = $error;
             return \Redirect::to('/backend/admin/mobile/songs/create')->withInput()->withErrors($validator);
         } else {
             $time = Carbon::now();
             $mp3path = public_path() . '/download/mp3/' . \Auth::user()->name . "/" . $time->year . "-" . $time->month;
             $mp3name = \Input::file('mp3')->getClientOriginalName();
             // $mp3rename = str_random(20);
             \Input::file('mp3')->move($mp3path, $mp3name);
             //  $uploadedfile = Storage::get($mp3rename.".".$mp3name);
             // Storage::disk('s3')->put($mp3rename.".".$mp3name, $uploadedfile);
             //  $url = Storage::disk('s3')->getDriver()->getAdapter()->getClient()->getObjectUrl('myanmarmusicart',$mp3rename.".".$mp3name);
             //  \File::delete(public_path().'/download/mp3/'. \Auth::user()->name."/". $time->year."-".$time->month."/".$mp3name);
             $encodeMp3name = rawurlencode($mp3name);
             $url = asset('/download/mp3/' . \Auth::user()->name . "/" . $time->year . "-" . $time->month . "/" . $encodeMp3name);
             $singlemusic->mp3 = $url;
         }
     }
     $singlemusic->songtitle = $request->input('songname');
     $singlemusic->singer = $request->input('singer');
     $singlemusic->language = $request->input('language');
     $singlemusic->categories = $request->input('categories');
     $singlemusic->content = $request->input('content');
     //   $singlemusic -> author =  \Auth::user() -> nickname;
     $singlemusic->save();
     \Flash::overlay('Mobile Api Edited!', "Complete");
     return \Redirect::to('/backend/admin/mobile/songs/');
 }
开发者ID:phyochan,项目名称:fan-mma,代码行数:52,代码来源:MobileSingleController.php

示例11: register

 public function register()
 {
     $first_name = ucwords(trim(Input::get('first_name')));
     $last_name = ucwords(trim(Input::get('last_name')));
     $email = Input::get('email');
     $phone = Input::get('phone');
     $password = Input::get('password');
     $picture = "";
     if (Input::hasfile('picture')) {
         $picture = Input::file('picture');
     }
     $device_token = Input::get('device_token');
     $device_type = Input::get('device_type');
     $bio = "";
     if (Input::has('bio')) {
         $bio = Input::get('bio');
     }
     $address = "";
     if (Input::has('address')) {
         $address = ucwords(trim(Input::get('address')));
     }
     $state = "";
     if (Input::has('state')) {
         $state = ucwords(trim(Input::get('state')));
     }
     $country = "";
     if (Input::has('country')) {
         $country = ucwords(trim(Input::get('country')));
     }
     $zipcode = "";
     if (Input::has('zipcode')) {
         $zipcode = Input::get('zipcode');
     }
     $login_by = Input::get('login_by');
     $social_unique_id = Input::get('social_unique_id');
     if ($password != "" and $social_unique_id == "") {
         $validator = Validator::make(array('password' => $password, 'email' => $email, 'first_name' => $first_name, 'last_name' => $last_name, 'picture' => $picture, 'device_token' => $device_token, 'device_type' => $device_type, 'bio' => $bio, 'address' => $address, 'state' => $state, 'country' => $country, 'zipcode' => $zipcode, 'login_by' => $login_by), array('password' => 'required', 'email' => 'required|email', 'first_name' => 'required', 'last_name' => 'required', 'picture' => '', 'device_token' => 'required', 'device_type' => 'required|in:android,ios', 'bio' => '', 'address' => '', 'state' => '', 'country' => '', 'zipcode' => 'integer', 'login_by' => 'required|in:manual,facebook,google'));
         $validatorPhone = Validator::make(array('phone' => $phone), array('phone' => 'phone'));
     } elseif ($social_unique_id != "" and $password == "") {
         $validator = Validator::make(array('email' => $email, 'first_name' => $first_name, 'last_name' => $last_name, 'picture' => $picture, 'device_token' => $device_token, 'device_type' => $device_type, 'bio' => $bio, 'address' => $address, 'state' => $state, 'country' => $country, 'zipcode' => $zipcode, 'login_by' => $login_by, 'social_unique_id' => $social_unique_id), array('email' => 'required|email', 'first_name' => 'required', 'last_name' => 'required', 'picture' => '', 'device_token' => 'required', 'device_type' => 'required|in:android,ios', 'bio' => '', 'address' => '', 'state' => '', 'country' => '', 'zipcode' => 'integer', 'login_by' => 'required|in:manual,facebook,google', 'social_unique_id' => 'required|unique:owner'));
         $validatorPhone = Validator::make(array('phone' => $phone), array('phone' => 'phone'));
     } elseif ($social_unique_id != "" and $password != "") {
         $response_array = array('success' => false, 'error' => 'Invalid Input - either social_unique_id or password should be passed', 'error_code' => 401);
         $response_code = 200;
         goto response;
     }
     if ($validator->fails()) {
         $error_messages = $validator->messages()->all();
         Log::info('Error while during owner registration = ' . print_r($error_messages, true));
         $response_array = array('success' => false, 'error' => 'Invalid Input', 'error_code' => 401, 'error_messages' => $error_messages);
         $response_code = 200;
     } else {
         if ($validatorPhone->fails()) {
             $error_messages = $validator->messages()->all();
             $response_array = array('success' => false, 'error' => 'Invalid Phone Number', 'error_code' => 401, 'error_messages' => $error_messages);
             $response_code = 200;
         } else {
             if (Owner::where('email', '=', $email)->first()) {
                 $response_array = array('success' => false, 'error' => 'Email ID already Registred', 'error_code' => 402);
                 $response_code = 200;
             } else {
                 /* SEND REFERRAL & PROMO INFO */
                 $settings = Settings::where('key', 'referral_code_activation')->first();
                 $referral_code_activation = $settings->value;
                 if ($referral_code_activation) {
                     $referral_code_activation_txt = "referral on";
                 } else {
                     $referral_code_activation_txt = "referral off";
                 }
                 $settings = Settings::where('key', 'promotional_code_activation')->first();
                 $promotional_code_activation = $settings->value;
                 if ($promotional_code_activation) {
                     $promotional_code_activation_txt = "promo on";
                 } else {
                     $promotional_code_activation_txt = "promo off";
                 }
                 /* SEND REFERRAL & PROMO INFO */
                 $owner = new Owner();
                 $owner->first_name = $first_name;
                 $owner->last_name = $last_name;
                 $owner->email = $email;
                 $owner->phone = $phone;
                 if ($password != "") {
                     $owner->password = Hash::make($password);
                 }
                 $owner->token = generate_token();
                 $owner->token_expiry = generate_expiry();
                 // upload image
                 $file_name = time();
                 $file_name .= rand();
                 $file_name = sha1($file_name);
                 if ($picture) {
                     $ext = Input::file('picture')->getClientOriginalExtension();
                     Input::file('picture')->move(public_path() . "/uploads", $file_name . "." . $ext);
                     $local_url = $file_name . "." . $ext;
                     // Upload to S3
                     if (Config::get('app.s3_bucket') != "") {
                         $s3 = App::make('aws')->get('s3');
                         $pic = $s3->putObject(array('Bucket' => Config::get('app.s3_bucket'), 'Key' => $file_name, 'SourceFile' => public_path() . "/uploads/" . $local_url));
                         $s3->putObjectAcl(array('Bucket' => Config::get('app.s3_bucket'), 'Key' => $file_name, 'ACL' => 'public-read'));
//.........这里部分代码省略.........
开发者ID:felipemarques8,项目名称:goentregas,代码行数:101,代码来源:OwnerController_old.php

示例12: foreach

 $_number = 1;
 if (Input::hasfile('filedetailTImage')) {
     foreach (Input::file("filedetailTImage") as $file) {
         $filename = $file->getClientOriginalName();
         if ($_number == $_countFiles) {
             $total_files .= $filename;
         } else {
             $total_files .= $filename . ';';
         }
         $upload_success = $file->move($destinationPath_Finch, $filename);
         $_number++;
     }
     $_salestable->detailTImage = Input::get($total_files, "1");
 }
 $filename_Banner = null;
 if (Input::hasfile('filedetailBImage')) {
     $file_Banner = Input::file("filedetailBImage");
     $filename_Banner = $file_Banner->getClientOriginalName();
     $upload_success_banner = $file->move($destinationPath_Finch, $filename_Banner);
     $_salestable->detailBImage = Input::get($filename_Banner, "1");
 }
 $_newdetailId = getdetailnumber();
 $_salestable->detailId = $_newdetailId;
 $_userData = Session::get('login');
 $_salestable->detailCreater = $_userData["username"];
 //$mytime = Carbon\Carbon::now();
 $_salestable->detailCreatedDate = date("Y-m-d H:i:s");
 $_salestable->save();
 $_salestablealias->detailId = $_newdetailId;
 $_finchid = null;
 if (Input::get("type") == 'SALE') {
开发者ID:ndmson,项目名称:FINCH,代码行数:31,代码来源:routes.php

示例13: add_printer

 public function add_printer()
 {
     try {
         $_arData = array();
         $total_files = null;
         $detailId = Input::get("detailId");
         $detailName = Input::get("detailName");
         $detailType = Input::get("detailType");
         $detailPDF = Input::get("detailPDF", null);
         $detailVideo = Input::get("detailVideo", null);
         $detailDescription = Input::get("detailDescription", null);
         $detailNewPrice = Input::get("detailNewPrice", null);
         $detailVisible = Input::get("detailVisible");
         if ($detailVisible == '1') {
             $detailVisible = '1';
         } else {
             $detailVisible = '0';
         }
         $destinationPath_Printer = 'asserts/images/Products/Printers';
         $_countFiles = count(Input::file("filedetailTImage"));
         $_number = 1;
         if (Input::hasfile('filedetailTImage')) {
             foreach (Input::file("filedetailTImage") as $file) {
                 $filename = $file->getClientOriginalName();
                 if ($_number == $_countFiles) {
                     $total_files .= $filename;
                 } else {
                     $total_files .= $filename . ';';
                 }
                 $upload_success = $file->move($destinationPath_Printer, $filename);
                 $_number++;
             }
         }
         $filename_Banner = null;
         if (Input::hasfile('filedetailBImage')) {
             $file_Banner = Input::file("filedetailBImage");
             $filename_Banner = $file_Banner->getClientOriginalName();
             $upload_success_banner = $file_Banner->move($destinationPath_Printer, $filename_Banner);
         }
         $newPrinter = new Printers();
         $newPrinter->detailId = $detailId;
         $newPrinter->detailName = $detailName;
         $newPrinter->detailType = $detailType;
         $newPrinter->detailPDF = $detailPDF;
         $newPrinter->detailVideo = $detailVideo;
         $newPrinter->detailDescription = $detailDescription;
         $newPrinter->detailNewPrice = $detailNewPrice;
         $newPrinter->detailVisible = $detailVisible;
         $newPrinter->detailBImage = $filename_Banner;
         $newPrinter->detailTImage = $total_files;
         $newPrinter->save();
         $printerId = Input::get("printerId", null);
         $newalias = new PrinterAlias();
         $newalias->printerId = $printerId;
         $newalias->detailId = $detailId;
         $newalias->save();
     } catch (Exception $_ex) {
         Session::flash('error', '$$$ --- Error (' . $_ex->getMessage() . ') --- $$$');
     }
     Session::flash('success', '$$$ --- Update Printer Successfully  --- $$$');
     return Redirect::to('qlm-admin/add-new-printer');
 }
开发者ID:ndmson,项目名称:Trade,代码行数:62,代码来源:AdminController.php

示例14: register

 public function register()
 {
     $first_name = ucwords(trim(Input::get('first_name')));
     $last_name = ucwords(trim(Input::get('last_name')));
     $email = Input::get('email');
     $phone = Input::get('phone');
     $password = Input::get('password');
     $type = Input::get('type');
     $picture = Input::file('picture');
     if (Input::hasfile('picture')) {
         $picture = Input::file('picture');
     } else {
         $picture = "";
     }
     $device_token = Input::get('device_token');
     $device_type = Input::get('device_type');
     $bio = Input::get('bio');
     $address = ucwords(trim(Input::get('address')));
     $state = ucwords(trim(Input::get('state')));
     $country = ucwords(trim(Input::get('country')));
     $zipcode = 0;
     if (Input::has('zipcode')) {
         $zipcode = Input::get('zipcode');
     }
     $login_by = Input::get('login_by');
     /* $car_model = 0;
        if (Input::has('car_model')) {
            $car_model = ucwords(trim(Input::get('car_model')));
        }
        $car_number = 0;
        if (Input::has('car_number')) {
            $car_number = Input::get('car_number');
        }*/
     $social_unique_id = Input::get('social_unique_id');
     if ($password != "" and $social_unique_id == "") {
         $validator = Validator::make(array('password' => $password, 'email' => $email, 'first_name' => $first_name, 'last_name' => $last_name, 'picture' => $picture, 'device_token' => $device_token, 'device_type' => $device_type, 'zipcode' => $zipcode, 'login_by' => $login_by), array('password' => 'required', 'email' => 'required|email', 'first_name' => 'required', 'last_name' => 'required', 'picture' => '', 'device_token' => 'required', 'device_type' => 'required|in:android,ios', 'zipcode' => 'integer', 'login_by' => 'required|in:manual,facebook,google'));
         $validatorPhone = Validator::make(array('phone' => $phone), array('phone' => 'phone'));
     } elseif ($social_unique_id != "" and $password == "") {
         $validator = Validator::make(array('email' => $email, 'phone' => $phone, 'first_name' => $first_name, 'last_name' => $last_name, 'picture' => $picture, 'device_token' => $device_token, 'device_type' => $device_type, 'bio' => $bio, 'address' => $address, 'state' => $state, 'country' => $country, 'zipcode' => $zipcode, 'login_by' => $login_by, 'social_unique_id' => $social_unique_id), array('email' => 'required|email', 'phone' => 'required', 'first_name' => 'required', 'last_name' => 'required', 'picture' => '', 'device_token' => 'required', 'device_type' => 'required|in:android,ios', 'bio' => '', 'address' => '', 'state' => '', 'country' => '', 'zipcode' => 'integer', 'login_by' => 'required|in:manual,facebook,google', 'social_unique_id' => 'required|unique:walker'));
         $validatorPhone = Validator::make(array('phone' => $phone), array('phone' => 'phone'));
     } elseif ($social_unique_id != "" and $password != "") {
         $response_array = array('success' => false, 'error' => 'Invalid Input - either social_unique_id or password should be passed', 'error_code' => 401);
         $response_code = 200;
         goto response;
     }
     if ($validator->fails()) {
         $error_messages = $validator->messages();
         Log::info('Error while during walker registration = ' . print_r($error_messages, true));
         $error_messages = $validator->messages()->all();
         $response_array = array('success' => false, 'error' => 'Invalid Input', 'error_code' => 401, 'error_messages' => $error_messages);
         $response_code = 200;
     } else {
         if ($validatorPhone->fails()) {
             $error_messages = $validator->messages()->all();
             $response_array = array('success' => false, 'error' => 'Invalid Phone Number', 'error_code' => 401, 'error_messages' => $error_messages);
             $response_code = 200;
         } else {
             if (Walker::where('email', '=', $email)->first()) {
                 $response_array = array('success' => false, 'error' => 'Email ID already Registred', 'error_code' => 402);
                 $response_code = 200;
             } else {
                 if (!$type) {
                     // choose default type
                     $provider_type = ProviderType::where('is_default', 1)->first();
                     if (!$provider_type) {
                         $type = 0;
                     } else {
                         $type = $provider_type->id;
                     }
                 }
                 $activation_code = uniqid();
                 $walker = new Walker();
                 $walker->first_name = $first_name;
                 $walker->last_name = $last_name;
                 $walker->email = $email;
                 $walker->phone = $phone;
                 $walker->activation_code = $activation_code;
                 if ($password != "") {
                     $walker->password = Hash::make($password);
                 }
                 $walker->token = generate_token();
                 $walker->token_expiry = generate_expiry();
                 // upload image
                 $file_name = time();
                 $file_name .= rand();
                 $file_name = sha1($file_name);
                 $s3_url = "";
                 if (Input::hasfile('picture')) {
                     $ext = Input::file('picture')->getClientOriginalExtension();
                     Input::file('picture')->move(public_path() . "/uploads", $file_name . "." . $ext);
                     $local_url = $file_name . "." . $ext;
                     // Upload to S3
                     if (Config::get('app.s3_bucket') != "") {
                         $s3 = App::make('aws')->get('s3');
                         $pic = $s3->putObject(array('Bucket' => Config::get('app.s3_bucket'), 'Key' => $file_name, 'SourceFile' => public_path() . "/uploads/" . $local_url));
                         $s3->putObjectAcl(array('Bucket' => Config::get('app.s3_bucket'), 'Key' => $file_name, 'ACL' => 'public-read'));
                         $s3_url = $s3->getObjectUrl(Config::get('app.s3_bucket'), $file_name);
                     } else {
                         $s3_url = asset_url() . '/uploads/' . $local_url;
                     }
//.........这里部分代码省略.........
开发者ID:felipemarques8,项目名称:goentregas,代码行数:101,代码来源:WalkerController.php

示例15: update_printer

 public function update_printer()
 {
     try {
         $_arData = array();
         $total_files = null;
         $detailName = Input::get("detailName");
         $detailType = Input::get("detailType");
         $detailPDF = Input::get("detailPDF");
         $detailVideo = Input::get("detailVideo");
         $detailDescription = Input::get("detailDescription");
         $detailOldPrice = Input::get("detailOldPrice");
         $detailNewPrice = Input::get("detailNewPrice");
         $detailVisible = Input::get("detailVisible");
         if ($detailVisible == '1') {
             $detailVisible = '1';
         } else {
             $detailVisible = '0';
         }
         $destinationPath_Printer = 'asserts/images/Products/Printers';
         $_countFiles = count(Input::file("filedetailTImage"));
         $_number = 1;
         if (Input::hasfile('filedetailTImage')) {
             foreach (Input::file("filedetailTImage") as $file) {
                 $filename = $file->getClientOriginalName();
                 if ($_number == $_countFiles) {
                     $total_files .= $filename;
                 } else {
                     $total_files .= $filename . ';';
                 }
                 $upload_success = $file->move($destinationPath_Printer, $filename);
                 $_number++;
             }
         }
         $filename_Banner = null;
         if (Input::hasfile('filedetailBImage')) {
             $file_Banner = Input::file("filedetailBImage");
             $filename_Banner = $file_Banner->getClientOriginalName();
             $upload_success_banner = $file->move($destinationPath_Printer, $filename_Banner);
         }
         if ($filename_Banner == null && $total_files == null) {
             $_arData = array('detailName' => $detailName, 'detailType' => $detailType, 'detailPDF' => $detailPDF, 'detailVideo' => $detailVideo, 'detailDescription' => $detailDescription, 'detailOldPrice' => $detailOldPrice, 'detailNewPrice' => $detailNewPrice, 'detailVisible' => $detailVisible);
         } else {
             if ($filename_Banner == null && $total_files != null) {
                 $_arData = array('detailName' => $detailName, 'detailType' => $detailType, 'detailPDF' => $detailPDF, 'detailVideo' => $detailVideo, 'detailDescription' => $detailDescription, 'detailOldPrice' => $detailOldPrice, 'detailNewPrice' => $detailNewPrice, 'detailVisible' => $detailVisible, 'eventPicturesContent' => $total_files);
             } else {
                 if ($filename_Banner != null && $total_files == null) {
                     $_arData = array('detailName' => $detailName, 'detailType' => $detailType, 'detailPDF' => $detailPDF, 'detailVideo' => $detailVideo, 'detailDescription' => $detailDescription, 'detailOldPrice' => $detailOldPrice, 'detailNewPrice' => $detailNewPrice, 'detailVisible' => $detailVisible, 'eventPictures' => $filename_Banner);
                 } else {
                     if ($filename_Banner != null && $total_files != null) {
                         $_arData = array('detailName' => $detailName, 'detailType' => $detailType, 'detailPDF' => $detailPDF, 'detailVideo' => $detailVideo, 'detailDescription' => $detailDescription, 'detailOldPrice' => $detailOldPrice, 'detailNewPrice' => $detailNewPrice, 'detailVisible' => $detailVisible, 'eventPictures' => $filename_Banner, 'eventPicturesContent' => $total_files);
                     }
                 }
             }
         }
         $_page_update = Printers::where('detailId', Input::get("detailId"))->update($_arData);
     } catch (Exception $_ex) {
         Session::flash('error', '$$$ --- Error (' . $_ex->getMessage() . ') --- $$$');
     }
     Session::flash('success', '$$$ --- Update Printer Successfully  --- $$$');
     return Redirect::to('qlm-admin/printers/' . Input::get("detailId"));
 }
开发者ID:ndmson,项目名称:FINCH,代码行数:61,代码来源:AdminController.php


注:本文中的Input::hasfile方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。