У меня есть файл, который очень хорошо работает на моей странице.Я также хочу использовать жесты swipeleft
и swiperight
из jQuery, но по какой-то причине загрузка моего файла завершается неудачно, если я использую следующие библиотеки:
https://code.jquery.com/jquery-1.11.3.min.js
https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js
Код Jquery:
<script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>
<script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>
<script>
$("#box").on("swiperight",function(){$('.active').prev().trigger('click');});
$("#box").on("swipeleft",function(){$('.active').next().trigger('click');});
</script>
Загрузка файлов работает очень хорошо, если я закомментирую две вышеупомянутые библиотеки, но тогда я не смогу использовать функцию считывания.
Часть загрузки файла обрабатывается посредством отправки формы PHP,Что я делаю не так?
Код PHP:
<?php
if(isset($_POST["submit"])){
$target= array();
$total = count($_FILES['file']['name']);
for( $i=0 ; $i < $total ; $i++ ) {
$tmpFilePath = $_FILES['file']['tmp_name'][$i];
if ($tmpFilePath != ""){
$newFilePath = "./uploads/" . $_FILES['file']['name'][$i];
if(move_uploaded_file($tmpFilePath, $newFilePath)) {
$target[$i]= $_FILES['file']['name'][$i];
}
}
}
}
?>
Код HTML:
<div class="card-container">
<div id="box"></div>
</div>
<form class="contact100-form validate-form" method="post" enctype="multipart/form-data">
<input class="input100" type="date" name="date" placeholder="Enter Date">
<input class="input100" type="file" multiple="multiple" name="file[]">
<button class="contact100-form-btn" type="submit" name="submit">
<span>
Submit
</span>
</button>
</form>