I want to accept only file which has ".zip" extension. I added a rule mime-type application/zip
to control this. But i dont know its content so i need to check zip file's content to avoid unknown files. How can I safely control the contents of a zip file?
I am using https://github.com/Chumper/Zipper to extract and laravel version is 5.5
public function store(Request $request, User $sharingUser) {
$rules = [
'patient_case_id' => 'required|exists:patient_cases,id',
'file' => 'required|mimes:zip,rar',
];
}
Uploaded zip file's content tree like this :
xxxx - MAIN FOLDER
|- aaaa.adf
|- bbbb.adf
|- cccc.adf
|- dddd.adf
|- aaaa.ocx
Folder can has only .adf and .ocx files... But i dont know how many files in folder.
note: it is a RESTful API