Hello -
You should use $request->file('name') to access uploaded files.
Hi all, Currently confused as where my file uploads have been disappearing to. It seems to work with one file but not multiple with different names. The $_FILES superglobal can still see all files.
I have tried to name the inputs using arrays but end up with the same error ie: attachment[0][1] etc
<form method="POST" action="{{route('questionnaires.answer',$questionnaire->id)}}" accept-charset="UTF-8" enctype="multipart/form-data">
...
<input name="attachment_1_0" type="file"/>
<input name="attachment_1_1" type="file"/>
...
</form>
public function answer(Request $request, Questionnaire $questionnaire)
{
dd($request->all());
}
array:2 [▼
"_token" => "e7v7ZxaKoIFGIYOscCAFwsoB8olw8lrNjwx8Azyi"
"attachment_1_0" => UploadedFile {#229 ▼
-test: false
-originalName: "db.png"
-mimeType: "image/png"
-size: 86110
-error: 0
#hashName: null
path: "C:\xampp\tmp"
filename: "phpF4F4.tmp"
basename: "phpF4F4.tmp"
pathname: "C:\xampp\tmp\phpF4F4.tmp"
extension: "tmp"
realPath: "C:\xampp\tmp\phpF4F4.tmp"
aTime: 2017-08-15 10:00:06
mTime: 2017-08-15 10:00:06
cTime: 2017-08-15 10:00:06
inode: 0
size: 86110
perms: 0100666
owner: 0
group: 0
type: "file"
writable: true
readable: true
executable: false
file: true
dir: false
link: false
linkTarget: "C:\xampp\tmp\phpF4F4.tmp"
}
]
public function answer(Request $request, Questionnaire $questionnaire)
{
dd($_FILES);
}
array:2 [▼
"attachment_1_0" => array:5 [▼
"name" => "BlackBoard BS Logo.jpg"
"type" => "image/jpeg"
"tmp_name" => "C:\xampp\tmp\phpD72F.tmp"
"error" => 0
"size" => 88788
]
"attachment_1_1" => array:5 [▼
"name" => ""
"type" => ""
"tmp_name" => ""
"error" => 4
"size" => 0
]
]
Any help would be greatly appreciated!
Please or to participate in this conversation.