Level 20
It will easier to find why eith a bit of code.
You have to insert it between two ```
I recently was testing out firefox, was using a site of mine. During a form post with 3 fields, a select input, upload input, and a text input.
public function uploadPost(Request $request)
{
$this->authorize('isadmin', new Upload);
//Make sure the data from the request is valid
$request->validate([
'name' => 'required|string|min:3|max:100',
'fileUpload' => 'required|file|mimes:audio/wav,audio/mp3,video/mp4,audio/mpeg,application/doc,application/docx|max:16484',
'group' => 'required|integer|min:1|max:50',
]);
$upload = new Upload;
$upload->name = $request->name;
$upload->group_id = $request->group;
$upload->extension = strtolower($request->file('fileUpload')->extension());
$filename = $request->file('fileUpload')->store('recordings');
if ($request->file('fileUpload')->isValid()) {
$upload->filename = $filename;
}
if ($upload->extension == "wav") {
$upload->mime_type = "audio/wav";
} elseif ($upload->extension == "mp3") {
$upload->mime_type = "audio/mpeg";
} elseif ($upload->extension == "mp4") {
$upload->mime_type = "video/mp4";
} elseif ($upload->extension == "doc" || $upload->extension == "docx") {
$upload->mime_type = "application/msword";
}
$upload->save();
$request->session()->flash('success', 1);
return redirect()->back();
}
Currently when I upload a file that doesn't pass the validator due to an incorrect mime type, chrome sends me back to the same page and I can view the errors at the top. Microsoft Edge does as well.
Chrome, Chrome Canary, and Microsoft Edge work properly, I see my post form with the validator errors above it.
Firefox v60.0.2, takes me back to the base welcome view and i end up at http://mysite/
Why does this happen?
*Edited.
Please or to participate in this conversation.