The following is an example in the Controller. Its images are dispensable, so they are separated separately for processing. Now, if you want to change it, the image must be uploaded. Can you combine the image with the text $ request-& amp; gt; all? How to modify the code? The following is the view under {code:
The following is an example in the Controller. Its images are dispensable, so they are separated separately for processing. Now, if you want to change it, that is, the image must be uploaded. Can you combine the image with the text $ request-> all? How to modify the code?
public function store(ArticleRequest $request){ $article = new Article($request->except('image')); $article -> user_id = Auth::id(); $picture = ""; if(Input::hasFile('image')) { $file = Input::file('image'); $filename = $file->getClientOriginalName(); $extension = $file -> getClientOriginalExtension(); $picture = sha1($filename . time()) . '.' . $extension; } $article -> picture = $picture; $article -> save(); if(Input::hasFile('image')) { $destinationPath = public_path() . '/images/article/'.$article->id.'/'; Input::file('image')->move($destinationPath, $picture); }}
The following is the view:
Reply content:
The following is an example in the Controller. Its images are dispensable, so they are separated separately for processing. Now, if you want to change it, that is, the image must be uploaded. Can you combine the image with the text $ request-> all? How to modify the code?
public function store(ArticleRequest $request){ $article = new Article($request->except('image')); $article -> user_id = Auth::id(); $picture = ""; if(Input::hasFile('image')) { $file = Input::file('image'); $filename = $file->getClientOriginalName(); $extension = $file -> getClientOriginalExtension(); $picture = sha1($filename . time()) . '.' . $extension; } $article -> picture = $picture; $article -> save(); if(Input::hasFile('image')) { $destinationPath = public_path() . '/images/article/'.$article->id.'/'; Input::file('image')->move($destinationPath, $picture); }}
The following is the view:
Can I perform asynchronous upload?