I'm running the following environment:
- PHP 7.1.7
- IIS 10
- Windows 10 1703
- Laravel 5.4.30
Here's my upload script (really simple, accepts all uploads):
public function uploadToTemporary(AttachmentUploadRequest $request)
{
/** @var \Illuminate\Http\UploadedFile $file */
$file = $request->file('file');
return [
'name' => $file->getClientOriginalName(),
'location' => $file->store('temporary'),
];
}
My AttachmentUploadRequest
rules:
public function rules()
{
return [
'file' => 'file|max:20000',
];
}
When I upload files with the extensions .msg
, .exe
, I receive:
(1/1) ErrorException fopen(C:\Users\Steve\Websites\tickets\storage\app\temporary/V4WslICBUK3TjK9Cn46nmKkXxtJVAGfDkxJiN9Lg.): failed to open stream: Permission denied
The thing is, I can upload every other type of file successfully. Here's the file extensions that upload successfully without any permission issues:
- .docx, .doc
- .pptx, .ppt
- .xlsx, .xls
- .txt
- .mp4, .avi, .mp3
- .vrd
- .jpg, .gif, .bmp
Does anyone know why this would happen?
EDIT: I verified that the files are being saved successfully in the temporary windows location by downloading a 1.1mb
executable and uploading it:
SecRule
directive – eithedmod_security
extension. By googling, looks like an Apache module? I don't have it configured, that's for sure. – Steve Bauman.exe
to.rename
or any other. So bizarre! – Steve Bauman