This is my HTML markup:
<p><input type="file" name="file[]" id="file" /></p>
<p><input type="file" name="file[]" id="file" /></p>
<p><input type="file" name="file[]" id="file" /></p>
<p><input type="file" name="file[]" id="file" /></p>
<p><input type="file" name="file[]" id="file" /></p>
When I submit the form, the form is submitting empty files. This is a print_r
of the array it sends:
Array
(
[name] => Array
(
[0] => thumb.jpg
[1] =>
[2] =>
[3] =>
[4] =>
)
[type] => Array
(
[0] => image/jpeg
[1] =>
[2] =>
[3] =>
[4] =>
)
[tmp_name] => Array
(
[0] => C:\xampp\tmp\phpEE16.tmp
[1] =>
[2] =>
[3] =>
[4] =>
)
[error] => Array
(
[0] => 0
[1] => 4
[2] => 4
[3] => 4
[4] => 4
)
[size] => Array
(
[0] => 5130
[1] => 0
[2] => 0
[3] => 0
[4] => 0
)
)
Is there a way to stop all these blank files being sent? As I have a feeling it's going to give me a headache later down the script. I thought I could check the error code for each file (4 if there is no file) and then unset it from the array, what do you think?