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


PHP Request::hasfile方法代码示例

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


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

示例1: postFormComment

 public function postFormComment(Request $request)
 {
     $id = $request->input('id', NULL);
     $message = "Se ingresó correctamente el comentario de la publicación.";
     $modelPostComment = new PuComments();
     $data = $request->all();
     if ($request->hasfile('picture')) {
         $validator = Validator::make($request->all(), ['picture' => ['mimes:jpg,png,jpeg']]);
         if ($validator->fails()) {
             return redirect(action('Admin\\PublicationController@postFormComment'))->withErrors($validator)->withInput();
         }
         $file = $request->file('picture');
         $nameimage = date('Ymdhis') . rand(1, 1000) . '.' . $file->getClientOriginalExtension();
         $file->move(public_path() . "/dinamic/pu_comment/", $nameimage);
         $pathImage = '/dinamic/pu_comment/' . $nameimage;
         $data['picture'] = $pathImage;
     }
     try {
         if (isset($id) && $id != '') {
             $Post = $modelPostComment->find($id);
             $Post->fill($data);
             $Post->save();
             $message = "Se actualizó la información del comentario de la  publicación de manera correcta.";
         } else {
             $modelPostComment->fill($data);
             $modelPostComment->save($data);
         }
     } catch (Exception $ex) {
     }
     $url = isset($data['modulo']) ? str_replace("|", "/", $data['modulo']) : self::NAMEC;
     return redirect('admpanel/' . $url)->with('messageSuccess', $message);
 }
开发者ID:josmel,项目名称:buen,代码行数:32,代码来源:PublicationController.php

示例2: ck_upload

 public function ck_upload(Request $request)
 {
     if ($request->hasfile('upload')) {
         $file = $request->file('upload');
         if (!$file->isValid()) {
             throw new Exception(trans('strings.image_not_invalid'));
         }
         $filename = uniqid() . time() . '.' . $file->getClientOriginalExtension();
         $file->move(public_path('images/ck'), $filename);
         return '<script type="text/javascript">window.parent.CKEDITOR.tools.callFunction(' . $request->input('CKEditorFuncNum') . ', "' . url('images/ck/' . $filename) . '","","' . $file->getClientOriginalName() . '");</script>';
     }
 }
开发者ID:angelWendy,项目名称:streamlet,代码行数:12,代码来源:ImagesController.php

示例3: store

 public function store(Request $request)
 {
     $validator = Validator::make($request->all(), ['nombre_pelicula' => "required", 'duracion_pelicula' => "required|integer", 'imagen_pelicula' => "required", 'formato_id_formato' => "required"]);
     if ($validator->fails()) {
         return redirect()->back()->withErrors($validator->errors());
     } else {
         $pelicula = new Pelicula();
         $pelicula->nombre_pelicula = $request->input('nombre_pelicula');
         $pelicula->duracion_pelicula = $request->input('duracion_pelicula');
         $pelicula->formato_id_formato = $request->input('formato_id_formato');
         if ($request->hasfile('imagen_pelicula')) {
             $pelicula->imagen_pelicula = $this->guardarArchivo($request->file('imagen_pelicula'));
         }
         $pelicula->save();
         return redirect('pelicula/list')->with('exito', 'La pelicula ha sido creado exitosamente');
     }
 }
开发者ID:hramose,项目名称:cinema,代码行数:17,代码来源:PeliculaController.php

示例4: UpdateAction

 /**
  * @param Request $request
  * @param $id
  * @return \Illuminate\Http\RedirectResponse
  */
 public function UpdateAction(Request $request, $id)
 {
     $this->package_image = Package_image::find($id);
     $url = MyHelper::clean(Input::get('title'));
     if ($this->package_image) {
         if ($this->check_package_id(Input::get('package_id'))) {
             if ($this->check_duplicate_url($id, $url)) {
                 if ($request->hasfile('image')) {
                     $rand = rand(100000, 50000) . "_";
                     $file = $request->file('image');
                     $image_name = $file->getClientOriginalName();
                     $new_image_name = $rand . $image_name;
                     if (File::exists($this->image_path)) {
                         $this->new_img_path = $this->image_path . '/' . $request->get('package_id');
                         /* unlink old image*/
                         $packages_id = $this->package_image->package_id;
                         $old_image = $this->package_image->image;
                         @unlink($this->image_path . '/' . $packages_id . '/' . $old_image);
                         /*replace by new image*/
                         @mkdir($this->new_img_path);
                         $file->move($this->new_img_path, $new_image_name);
                     }
                     $this->package_image->package_id = $request->get('package_id');
                     $this->package_image->title = $request->get('title');
                     $this->package_image->image = $new_image_name;
                     $this->package_image->url = $url;
                     $this->package_image->short_description = $request->get('short_description');
                     $this->package_image->detail_description = $request->get('detail_description');
                     $this->package_image->status = $request->get('status');
                     $this->package_image->save();
                     return redirect()->route('package_image/list')->with('response.CUSTOM_MESSAGE_SUCCESS', ['message' => 'The Package Image field is successfully added']);
                 }
                 $this->package_image->package_id = $request->get('package_id');
                 $this->package_image->title = $request->get('title');
                 $this->package_image->url = $url;
                 $this->package_image->short_description = $request->get('short_description');
                 $this->package_image->detail_description = $request->get('detail_description');
                 $this->package_image->status = $request->get('status');
                 $this->package_image->save();
                 return redirect()->route('package_image/list')->with('response.CUSTOM_MESSAGE_SUCCESS', ['message' => 'The Package Image field is successfully added']);
             }
             return redirect()->route('package_image/list')->with('response.CUSTOM_MESSAGE_ALERT', ['message' => 'Invalid package id']);
         }
         return redirect()->route('package_image/list')->with('response.CUSTOM_MESSAGE_ALERT', ['message' => 'Invalid package id']);
     }
     return redirect()->route('package_image/list')->with('response.CUSTOM_MESSAGE_ALERT', ['message' => 'Invalid Package Image ID']);
 }
开发者ID:kumarsubedi93,项目名称:laravel_docs,代码行数:52,代码来源:Package_imageController.php

示例5: UpdateAction

 /**
  * Update the specified resource in storage.
  *
  * @param  Request $request
  * @param  int $id
  * @return Response
  */
 public function UpdateAction(Request $request, $id)
 {
     $this->country = Country::find($id);
     if ($this->country) {
         /*check for duplicate url*/
         $url = MyHelper::clean(Input::get('name'));
         if ($this->__checkForDuplicateUul($id, $url)) {
             /*For Imaging processing*/
             if ($request->hasfile('image')) {
                 $rand = rand(10000, 88888) . '_';
                 $file = $request->file('image');
                 $image_name = $file->getClientOriginalName();
                 $new_image_name = $rand . $image_name;
                 if (!File::exists(public_path() . '/images/country')) {
                     return redirect()->back()->with('message', Lang::get('response.CUSTOM_MESSAGE_ALERT', ['message' => 'The image Directory is not found']));
                 }
                 $get_old_image = $this->country->image;
                 $file->move(public_path() . '/images/country', $new_image_name);
                 @unlink(public_path() . '/images/country/' . $get_old_image);
                 $this->country->name = $request->name;
                 $this->country->url = $url;
                 $this->country->image = $new_image_name;
                 $this->country->short_description = $request->short_description;
                 $this->country->detail_description = $request->detail_description;
                 $this->country->status = $request->status;
                 $this->country->save();
                 return redirect()->route('country/list')->withInput()->with('message', Lang::get('response.CUSTOM_MESSAGE_SUCCESS', ['message' => 'The country field successfully Updated']));
             } else {
                 $this->country->name = $request->name;
                 $this->country->url = $url;
                 $this->country->short_description = $request->short_description;
                 $this->country->detail_description = $request->detail_description;
                 $this->country->status = $request->status;
                 $this->country->save();
                 return redirect()->route('country/list')->withInput()->with('message', Lang::get('response.CUSTOM_MESSAGE_SUCCESS', ['message' => 'The country field successfully Updated']));
             }
         }
         return redirect()->back()->withInput()->with('message', Lang::get('response.CUSTOM_MESSAGE_ALERT', ['message' => 'Invalid Url Request']));
     }
     return redirect()->back()->withInput()->with('message', Lang::get('response.CUSTOM_MESSAGE_ALERT', ['message' => 'Invalid Request']));
 }
开发者ID:kumarsubedi93,项目名称:laravel_docs,代码行数:48,代码来源:CountryController.php

示例6: UpdateAction

 /**
  * Update the specified resource in storage.
  *
  * @param  Request $request
  * @param  int $id
  * @return Response
  */
 public function UpdateAction(Request $request, $id)
 {
     $this->category = category::find($id);
     if ($this->category) {
         $url = MyHelper::clean(Input::get('name'));
         $this->country = Country::find(Input::get('country_id'));
         if (!$this->country) {
             return redirect()->back()->with('message', Lang::get('response.CUSTOM_MESSAGE_WARNING', ['message' => 'Country ID did not match']));
         }
         if ($this->__checkForDuplicateUrl($id, $this->country->id, $url)) {
             if ($request->hasfile('image')) {
                 $file = $request->file('image');
                 $image_name = $file->getClientOriginalName();
                 $rand = rand(5000, 60000) . '_';
                 $new_img_name = $rand . $image_name;
                 $get_old_image = $this->category->image;
                 if (!File::exists($this->image_path)) {
                     return redirect()->back()->with('message', Lang::get('response.CUSTOM_MESSAGE_WARNING', ['message' => 'No image Folder']));
                 }
                 @unlink($this->image_path . '/' . $get_old_image);
                 $file->move($this->image_path, $new_img_name);
                 $this->category->country_id = $request->get('country_id');
                 $this->category->name = $request->get('name');
                 $this->category->url = $url;
                 $this->category->image = $new_img_name;
                 $this->category->short_description = $request->get('short_description');
                 $this->category->detail_description = $request->get('detail_description');
                 $this->category->status = $request->get('status');
                 $this->category->save();
                 return redirect()->route('category/list')->with('message', Lang::get('response.CUSTOM_MESSAGE_SUCCESS', ['message' => 'The category field is successfully updated']));
             }
             $this->category->country_id = $request->get('country_id');
             $this->category->name = $request->get('name');
             $this->category->url = $url;
             $this->category->short_description = $request->get('short_description');
             $this->category->detail_description = $request->get('detail_description');
             $this->category->status = $request->get('status');
             $this->category->save();
             return redirect()->route('category/list')->with('message', Lang::get('response.CUSTOM_MESSAGE_SUCCESS', ['message' => 'The category has been Updated']));
         }
         return redirect()->back()->with('message', Lang::get('response.CUSTOM_MESSAGE_WARNING', ['message' => 'Duplicate  Url supply']));
     }
     return redirect()->back()->with('message', Lang::get('response.CUSTOM_MESSAGE_WARNING', ['message' => 'Invalid request supply']));
 }
开发者ID:kumarsubedi93,项目名称:laravel_docs,代码行数:51,代码来源:CategoryController.php

示例7: postFileUpload

 public function postFileUpload(Request $request)
 {
     $response = ['error' => 0, 'filelink' => '', 'multiple' => []];
     //Make sure folders exist
     $dir = Config::get('scaffenger.config.uploads_folder');
     if (!is_dir($dir)) {
         mkdir($dir);
     }
     if ($request->hasfile('dzfile')) {
         $file = $request->file('dzfile');
         try {
             $extension = $file->getClientOriginalExtension();
             $filename = str_replace('.' . $extension, '', $file->getClientOriginalName());
             $filename = Str::slugify($filename) . '.' . $extension;
             $file->move($dir, $filename);
             $response['filelink'] = Config::get('app.url') . str_replace(public_path(), '', $dir) . '/' . $filename;
         } catch (Exception $e) {
             $response['error'] = 1;
         }
     }
     return response()->json($response);
 }
开发者ID:wislem,项目名称:scaffenger,代码行数:22,代码来源:ScaffengerController.php

示例8: UpdateAction

 /**
  * Update the specified resource in storage.
  *
  * @param  Request $request
  * @param  int $id
  * @return Response
  */
 public function UpdateAction(Request $request, $id)
 {
     $this->page = Page::find($id);
     if ($this->page) {
         $url = MyHelper::clean($request->get('title'));
         /*check duplicate url*/
         if ($this->__checkduplicateurl($this->page->id, $url)) {
             $rand = rand(5000, 60000) . '_';
             if ($request->hasfile('image')) {
                 $file = $request->file('image');
                 $name = $file->getClientOriginalName();
                 $new_name = $rand . $name;
                 $find_old_image = $this->page->image;
                 if (!File::exists($this->image_path)) {
                     return redirect()->back()->with('message', Lang::get('response.CUSTOM_MESSAGE_ALERT', ['message' => 'Image folder not found']));
                 }
                 $file->move($this->image_path, $new_name);
                 @unlink($this->image_path . '/' . $find_old_image);
                 $this->page->title = $request->get('title');
                 $this->page->url = $url;
                 $this->page->parent_id = $request->get('parent_id');
                 $this->page->image = $new_name;
                 $this->page->short_description = $request->get('short_description');
                 $this->page->detail_description = $request->get('detail_description');
                 $this->page->status = $request->get('status');
                 $this->page->section = $request->get('section');
                 $this->page->save();
                 return redirect()->route('page/list')->with('message', Lang::get('response.CUSTOM_MESSAGE_SUCCESS', ['message' => 'The page Field is successfully updated']));
             }
             $this->page->title = $request->get('title');
             $this->page->url = $url;
             $this->page->parent_id = $request->get('parent_id');
             $this->page->short_description = $request->get('short_description');
             $this->page->detail_description = $request->get('detail_description');
             $this->page->status = $request->get('status');
             $this->page->section = $request->get('section');
             $this->page->save();
             return redirect()->route('page/list')->with('message', Lang::get('response.CUSTOM_MESSAGE_SUCCESS', ['message' => 'The page Field is successfully updated']));
         }
         return redirect()->back()->with('message', Lang::get('response.CUSTOM_MESSAGE_ALERT', ['message' => 'Duplicate Url']));
     }
     return redirect()->back()->with('message', Lang::get('response.CUSTOM_MESSAGE_ALERT', ['message' => 'Invalid Request']));
 }
开发者ID:kumarsubedi93,项目名称:laravel_docs,代码行数:50,代码来源:PageController.php

示例9: UpdateAction

 /**
  * Update the specified resource in storage.
  *
  * @param  Request $request
  * @param  int $id
  * @return Response
  */
 public function UpdateAction(Request $request, $id)
 {
     $this->banner = Banner::find($id);
     if ($this->banner) {
         $rand = rand(2000, 6000) . '_';
         if ($request->hasfile('image')) {
             $file = $request->file('image');
             $image_name = $file->getClientOriginalName();
             $new_image_name = $rand . $image_name;
             if (!File::exists($this->image_path)) {
                 return redirect()->back()->with('message', Lang::get('response.CUSTOM_MESSAGE_ALERT', ['message' => 'The image folder not exits']));
             }
             $file->move($this->image_path, $new_image_name);
             $old_image = $this->banner->image;
             @unlink($this->image_path . '/' . $old_image);
             $this->banner->title = $request->get('title');
             $this->banner->image = $new_image_name;
             $this->banner->short_description = $request->get('short_description');
             $this->banner->detail_description = $request->get('detail_description');
             $this->banner->status = $request->get('status');
             $this->banner->save();
             return redirect()->route('banner/list')->with('message', Lang::get('response.CUSTOM_MESSAGE_SUCCESS', ['message' => 'The Banner Field has successfully Updated']));
         }
         $this->banner->title = $request->get('title');
         $this->banner->short_description = $request->get('short_description');
         $this->banner->detail_description = $request->get('detail_description');
         $this->banner->status = $request->get('status');
         $this->banner->save();
         return redirect()->route('banner/list')->with('message', Lang::get('response.CUSTOM_MESSAGE_SUCCESS', ['message' => 'The Banner Field has successfully Updated']));
     }
     return redirect()->back()->with('message', Lang::get('response.CUSTOM_MESSAGE_ALERT', ['message' => 'Invalid']));
 }
开发者ID:kumarsubedi93,项目名称:laravel_docs,代码行数:39,代码来源:BannerController.php

示例10: UpdateAction

 /**
  * Update the specified resource in storage.
  *
  * @param  Request $request
  * @param  int $id
  * @return Response
  */
 public function UpdateAction(Request $request, $id)
 {
     /* MyHelper::debug(Input::all(),1);die;*/
     $this->package = Package::find($id);
     if (!$this->package) {
         return redirect()->back()->withInput()->with('message', Lang::get('response.CUSTOM_MESSAGE_ALERT', ['message' => 'Invalid Package id']));
     }
     $this->country = Country::find($request->get('country_id'));
     if (!$this->country) {
         return redirect()->back()->withInput()->with('message', Lang::get('response.CUSTOM_MESSAGE_ALERT', ['message' => 'Invalid Country id']));
     }
     $this->category = category::find($request->get('category_id'));
     if (!$this->category) {
         return redirect()->back()->withInput()->with('message', Lang::get('response.CUSTOM_MESSAGE_ALERT', ['message' => 'Invalid Category id']));
     }
     $url = MyHelper::clean($request->get('title'));
     $rand = rand(20000, 300000) . '_';
     if ($this->__checkForDuplicate_url($id, $this->category->id, $url)) {
         if ($request->hasfile('image')) {
             $file = $request->file('image');
             $image_name = $file->getClientOriginalName();
             $image_new_name = $rand . $image_name;
             $find_old_image = $this->package->image;
             @unlink($this->image_path . '/' . $find_old_image);
             if (!File::exists($this->image_path)) {
                 return redirect()->back()->withInput()->with('message', Lang::get('response.CUSTOM_MESSAGE_ALERT', ['message' => 'Image Folder not found']));
             }
             $file->move($this->image_path, $image_new_name);
             $this->package->category_id = $request->get('category_id');
             $this->package->title = $request->get('title');
             $this->package->url = $url;
             $this->package->image = $image_new_name;
             $this->package->is_special = $request->get('is_special');
             $this->package->grade = $request->get('grade');
             $this->package->currency = $request->get('currency');
             $this->package->price = $request->get('price');
             $this->package->route = $request->get('route');
             $this->package->duration = $request->get('duration');
             $this->package->itinerary = $request->get('itinerary');
             $this->package->const_description = $request->get('const_description');
             $this->package->short_description = $request->get('short_description');
             $this->package->detail_description = $request->get('detail_description');
             $this->package->status = $request->get('status');
             $this->package->save();
         }
         $this->package->category_id = $request->get('category_id');
         $this->package->title = $request->get('title');
         $this->package->url = $url;
         $this->package->is_special = $request->get('is_special');
         $this->package->grade = $request->get('grade');
         $this->package->currency = $request->get('currency');
         $this->package->price = $request->get('price');
         $this->package->route = $request->get('route');
         $this->package->duration = $request->get('duration');
         $this->package->itinerary = $request->get('itinerary');
         $this->package->const_description = $request->get('const_description');
         $this->package->short_description = $request->get('short_description');
         $this->package->detail_description = $request->get('detail_description');
         $this->package->status = $request->get('status');
         $this->package->save();
         return redirect()->route('package/list')->with('message', Lang::get('response.CUSTOM_MESSAGE_SUCCESS', ['message' => 'The package hasbeen successfully  updated']));
     }
     return redirect()->back()->withInput()->with('message', Lang::get('response.CUSTOM_MESSAGE_ALERT', ['message' => 'Duplicate  url']));
 }
开发者ID:kumarsubedi93,项目名称:laravel_docs,代码行数:71,代码来源:PackageController.php

示例11: UpdateAction

 /**
  * Update the specified resource in storage.
  *
  * @param  Request $request
  * @param  int $id
  * @return Response
  */
 public function UpdateAction(Request $request, $id)
 {
     $this->gallery = Gallery::find($id);
     $url = MyHelper::clean(Input::get('title'));
     if ($this->__checkAlbumId(Input::get('albums_id'))) {
         if ($this->__checkDuplicateUrl($this->gallery->id, Input::get('album_id'), $url)) {
             $rand = rand(10000, 50000) . '_i';
             if ($request->hasfile('image')) {
                 $file = $request->file('image');
                 $image_name = $file->getClientOriginalName();
                 $new_image_name = $rand . $image_name;
                 if (!File::exists($this->image_path)) {
                     return redirect()->back()->with('message', Lang::get('response.CUSTOM_MESSAGE_ALERT', ['message' => 'Image folder not found']));
                 }
                 $old_image = $this->gallery->image;
                 @unlink($this->image_path . '/' . $old_image);
                 $file->move($this->image_path, $new_image_name);
                 $this->gallery->albums_id = $request->get('albums_id');
                 $this->gallery->title = $request->get('title');
                 $this->gallery->url = $url;
                 $this->gallery->image = $new_image_name;
                 $this->gallery->short_description = $request->get('short_description');
                 $this->gallery->detail_description = $request->get('detail_description');
                 $this->gallery->status = $request->get('status');
                 $this->gallery->save();
                 return redirect()->route('gallery/list')->with('message', Lang::get('response.CUSTOM_MESSAGE_SUCCESS', ['message' => 'The Gallery Section Successfully Updated']));
             }
             $this->gallery->albums_id = $request->get('albums_id');
             $this->gallery->title = $request->get('title');
             $this->gallery->url = $url;
             $this->gallery->short_description = $request->get('short_description');
             $this->gallery->detail_description = $request->get('detail_description');
             $this->gallery->status = $request->get('status');
             $this->gallery->save();
             return redirect()->route('gallery/list')->with('message', Lang::get('response.CUSTOM_MESSAGE_SUCCESS', ['message' => 'The Gallery Section Successfully Updated']));
         }
         return redirect()->back()->with('message', Lang::get('response.CUSTOM_MESSAGE_ALERT', ['message' => 'Diplicate Url']));
     }
     return redirect()->back()->with('message', Lang::get('response.CUSTOM_MESSAGE_ALERT', ['message' => 'Album id No found']));
 }
开发者ID:kumarsubedi93,项目名称:laravel_docs,代码行数:47,代码来源:GalleryController.php

示例12: UpdateAction

 /**
  * Update the specified resource in storage.
  *
  * @param  Request $request
  * @param  int $id
  * @return Response
  */
 public function UpdateAction(Request $request, $id)
 {
     $this->media = Media::find($id);
     $url = MyHelper::clean(Input::get('title'));
     if ($this->media) {
         if ($this->check_gallery_id($this->media->galleries_id)) {
             if ($this->check_duplicate_url($id, $this->media->gallery_id, $url)) {
                 if ($request->hasfile('media')) {
                     $rand = rand(100000, 9000000) . '_img';
                     $file = $request->file('media');
                     $image_name = $file->getClientOriginalName();
                     $new_image = $rand . $image_name;
                     if (File::exists($this->image_path)) {
                         $old_image = $this->media->media;
                         $gallery_id = $this->media->galleries_id;
                         @unlink($this->image_path . '/' . $gallery_id . '/' . $old_image);
                         $this->dir = $this->image_path . '/' . Input::get('galleries_id');
                         @mkdir($this->dir);
                         $file->move($this->dir, $new_image);
                     }
                     $this->media->galleries_id = $request->get('galleries_id');
                     $this->media->title = $request->get('title');
                     $this->media->media_type = $request->get('media_type');
                     $this->media->media = $new_image;
                     $this->media->short_description = $request->get('short_description');
                     $this->media->url = $url;
                     $this->media->detail_description = $request->get('detail_description');
                     $this->media->status = $request->get('status');
                     $this->media->save();
                     return redirect()->route('media/list')->with('message', Lang::get('response.CUSTOM_MESSAGE_SUCCESS', ['message' => 'The media field is successfully Updated']));
                 }
                 $this->media->galleries_id = $request->get('galleries_id');
                 $this->media->title = $request->get('title');
                 $this->media->media_type = $request->get('media_type');
                 $this->media->short_description = $request->get('short_description');
                 $this->media->url = $url;
                 $this->media->detail_description = $request->get('detail_description');
                 $this->media->status = $request->get('status');
                 $this->media->save();
                 return redirect()->route('media/list')->with('message', Lang::get('response.CUSTOM_MESSAGE_SUCCESS', ['message' => 'The media field is successfully Updated']));
             }
             return redirect()->back()->with('message', Lang::get('response.CUSTOM_MESSAGE_ALERT', ['message' => 'Duplicate Url']));
         }
         return redirect()->back()->with('message', Lang::get('response.CUSTOM_MESSAGE_ALERT', ['message' => 'Invalid Gallery id']));
     }
     return redirect()->back()->with('message', Lang::get('response.CUSTOM_MESSAGE_ALERT', ['message' => 'Invalid media id']));
 }
开发者ID:kumarsubedi93,项目名称:laravel_docs,代码行数:54,代码来源:MediaController.php

示例13: postaddstudent

 public function postaddstudent(Request $request, Filesystem $fs)
 {
     if ($request->session()->get('type') == 'Admin') {
         $id_num = $request->input('id_num');
         $photo = $request->file('photo');
         $request->file('photo')->move('students/', $id_num . '.jpg');
         $fname = $request->input('fname');
         $lname = $request->input('lname');
         $gender = $request->input('gender');
         $lname = $request->input('lname');
         $course = $request->input('course');
         $yrLevel = $request->input('yrLevel');
         //$fs->put($id_num.'.jpg', $photo);
         if ($request->hasfile('photo')) {
             DB::insert('insert into students (id_num, photo, stud_fname, stud_lname, course, yrlevel, active, stud_gender) values (?, ?, ?, ?, ?, ?, ?, ?)', [$id_num, '/students/' . $id_num . '.jpg', $fname, $lname, $course, $yrLevel, false, $gender]);
             return redirect('/');
         } else {
             return 'error';
         }
     }
 }
开发者ID:ardeelete,项目名称:FileRequester,代码行数:21,代码来源:PagesController.php


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