I have error php?

Hello, is the code to load multiple images on the server, why is the record in the database with the error: notice undefined offset?

Here is the code:
$count = 3;
 $i = 0;
 $path = '../7qrIA0kQ/';

if( isset($data['step_6']) && count($_FILES)) {
 for ($i = 0; $i <= $count; $i++) {
 $newnames = [];
 if (!empty($_FILES['file']['name'][$i])) {
 if ($info = also($_FILES['file']['tmp_name'][$i])) {
 $image = imagecreatefromstring(file_get_contents($_FILES['file']['tmp_name'][$i]));
 $name = explode('.', $_FILES['file']['name'][$i]);
 // processing and saving
 $newname = $path . time() . $name[0] . '.png'; // this is the name for the database, even the full path, only the name can be obtained for example using basename();
 $newnames[] = $newname; // basename($name);
 imagepng($image, $newname, 9 , PNG_ALL_FILTERS);

 print_r ($newnames);
exit;

 $contract = R::findOne('contract', 'uid = ?', array($user_id));
 $contract->img_1 = $newnames[0];
 $contract->img_2 = $newnames[1];
 $contract->img_3 = $newnames[2];
R::store($contract);

 } else {
 echo '<h2>Nevering format . $_FILES['file']['name'][$i] . '</h2>';
}
}
}
}

<?php while (++$i <= $count) : ?>
 <div class="field__wrapper">
 <input type="file" name="file[]" required="required" class="field field__file"/>
 <label class="field__file-wrapper" for="field__file">
 <div class="field__file-fake">Photos</div>
 <div class="field__file-button">Choose</div>
</label>
</div>
 <?php endwhile; ?>
April 4th 20 at 12:56
0 answer

Find more questions by tags PHP