I have a weird case here where I can't upload some txt file
I created 5 txt files in the desktop and tried to upload to my server with laravel. The content and how I create the files are all the same by right-clicking and click new document and another method is copy-paste and just rename the files.
Here's the code to check the file.
$rules = ['upload_file' => 'required|file|mimes:txt|max:15000'];
$validator = Validator::make($request->all(),$rules);
if($validator->fails()){ // check if there's any error
foreach($validator->errors()->all() as $key => $value) {
@$errMess .= $value;
}
$message = ['message' => $errMess ];
// show the error
return response()->json($status);
}
//else continue to upload file to server
The failed error from Validator is
The upload file must be a file of type: txt.
I have checked everything like permission of the temp files, the differences of the file with dd()
, php error and I still can't figure it out
Here's the dd of the succeed and failed files.
Success DD Image Failed DD Image
from Newest questions tagged laravel-5 - Stack Overflow https://ift.tt/2rhOwMv
via IFTTT
Aucun commentaire:
Enregistrer un commentaire