Level 29
What do you want to validate it against. couple of options are mime type, dimensions ( for images), file size, etc.
Hello,
What's a proper way for validating Uploaded files?
Right now I've this for uploading files (that works):
$file = $request->file('file');
if(Input::hasfile('file')){
foreach ($file as $f) {
$name = time() .$f->getClientOriginalName();
$userid = Auth::user()->id;
$f->move('files/'.$userid.'/ticketimages',$name);
$ticket->image()->create(['path' => '/files/'.$userid.'/ticketimages/'.$name,'name' => $name]);
}
//$this->mailer->ticketToAdmin($ticket);
}
Already followed this video:
https://laracasts.com/lessons/file-uploads-101
But validating files is not covered here.
Some help please.
Please or to participate in this conversation.