I'm trying to figure out what is wrong with my validation, but I'm not sure.
I have created a file upload that uploads the file to S3. Works fine except when I need to validate python files.
In my FileUploadController.php
I have a store(FileStoreRequest $request)
method that handles the upload. I added the $validatedData = $request->validate();
in it and it works.
I have also added the mimes.php
in config
folder with the following:
<?php
return [
'zip' => array('application/x-zip', 'application/zip', 'application/x-zip-compressed'),
'py' => array('text/plain', 'application/x-python' , 'application/octet-stream, application/x-python-code, text/x-python-script', 'text/x-python'),
];
And the rules()
method inside my FileStoreRequest
class is
public function rules()
{
return [
'preprocessor' => 'mimes:py',
];
}
Any time I try to upload the python file I get the error
The preprocessor must be a file of type: py.
When I remove the mimes check from the rules()
it passes.
The rules work, because I tested it on another view for zip file upload.
Any ideas what could be wrong?