8.4+: How to get $_FILES post data
Permalink
You get post data from inputs like:
However, this doesn't get file upload data. But even
return empty strings. But if I use $data instead of $_FILES, it throws an error: "Illegal string offset 'tmp_name'"
What's the c5 way of getting uploaded file info?
I have to validate the file before it's uploaded, i.e. I can't use the importer yet.
Thank you.
$data = $this->request->request->all();
However, this doesn't get file upload data. But even
$photo = $_FILES['photo']['tmp_name']; $photo_name = mb_strtolower($_FILES['photo']['name']); $photo_size = $_FILES['photo']['size']; $photo_type = pathinfo($photo_name, PATHINFO_EXTENSION);
return empty strings. But if I use $data instead of $_FILES, it throws an error: "Illegal string offset 'tmp_name'"
What's the c5 way of getting uploaded file info?
I have to validate the file before it's uploaded, i.e. I can't use the importer yet.
Thank you.
I forgot to add enctype="multipart/form-data" to the form