When I uploaded some videos via a form it saved my videos on the public folder but in the view
I can't access them.
my view (tyring to output the filepath)
<td> </td>
<td> </td>
result
C:\Users\Jeffrey\AppData\Local\Temp\phpBB7C.tmp
C:\Users\Jeffrey\AppData\Local\Temp\phpBB7C.tmp
it supposed to be on a different path (my project path).
On my local computer on the videos folder I can see that the videos was uploaded.
Mycontroller.php
public function store(Request $request)
{
// Validation //
$validation = Validator::make($request->all(), [
'about_me' => 'required',
'video_ogg' => 'required|mimes:mp4,ogx,oga,ogv,ogg,webm|min:1|max:3240',
'video_mp4' => 'required|mimes:mp4,mov,ogg,qt,webm|min:1|max:3240'
]);
// Check if it fails //
if( $validation->fails() ){
return redirect()->back()->withInput()
->with('errors', $validation->errors() );
}
$profile = new Profile;
// upload the media //
$file = $request->file('video_ogg');
$destination_path = 'videos/';
$filename = str_random(6).'_'.$file->getClientOriginalName();
$file->move($destination_path, $filename);
// upload the media //
$file = $request->file('video_mp4');
$destination_path = 'videos/';
$filename = str_random(6).'_'.$file->getClientOriginalName();
$file->move($destination_path, $filename);
// save media data into database //
$profile->about_me = $request->input('about_me');
$profile->video_mp4 = $request->file('video_mp4');
$profile->video_ogg = $request->file('video_ogg');
$profile->save();
return redirect('/profile')->with('message','You just created your profile!');
}
file permission (on Windows powershell)
So how can I can get the right path on the view
?
because it supposed to be : videos/QvWjJ2_mov_bbb.mp4
and videos/muWzE9_mov_bbb.ogg
via Chebli Mohamed
Aucun commentaire:
Enregistrer un commentaire