Я пишу код в CodeIgniter для публикации данных для публикации данных с несколькими загрузчиками файлов.Он работает в веб-браузере.Но на мобильных устройствах мой код не работает
Данные передаются в виде Data.Я проверяю это в мобильном телефоне, все переменные данных поста пустыНо на рабочем столе это показывает мне все переменные
Вот почтовый индекс jQuery AJAX
var form_data = new FormData($("#form-upload")[0]);
// all data append in this form data
$.ajax({
url: 'API_Create/ExpenseReport',
type: "post",
dataType: 'json',
processData: false,
contentType: "application/json; charset=utf-8",
data: form_data,
success: function(data) {
data = $.parseJSON(data);
if (data == true) {
toastr.success('Expense Report Created.!');
$('#dateexpense').val();
$('#expensename').val();
$('#expensebranch').val('');
$('#expenseworkorder').val('');
$('#expensefuel').val('');
$('#foodallowance').val('');
$('#expenseticket').val();
$('#roomallowance').val();
$('#localtransport').val('');
$('#tolltax').val('');
$('#angelfabricate').val('');
$('#materialpurchase').val('');
$('#telephone').val('');
$('#otherexpensesdetails').val('');
$('#spinwait').hide();
//location.href = '/AdminList';
} else if (data == '-1') {
toastr.success('Expense Report Created.!');
$('#spinwait').hide();
} else {
toastr.success('Expense Report Created.!');
$('#spinwait').hide();
}
$.each(data, function(k, v) {});
},
error: function(jqXHR, textStatus, errorThrown) {
toastr.error('Expense Report Created.!');
$('#spinwait').hide();
}
});
HTML
<div class="mainbar">
<!-- Page heading -->
<div class="page-head">
<!-- Page heading -->
<h2 class="pull-left">Expense Report
<!-- page meta -->
<!--<span class="page-meta">Fields with * are mandatory</span>--> </h2>
<!-- Breadcrumb -->
<div class="bread-crumb pull-right"> <a href="/"><i class="fa fa-home"></i> Home</a>
<!-- Divider -->
<span class="divider">/</span> <a href="#" class="bread-current">Forms</a> </div>
<div class="clearfix"></div>
</div>
<!--/ Page heading ends -->
<!-- Matter -->
<div class="matter">
<div class="container">
<div class="row">
<div class="col-md-12">
<div class="widget wgreen">
<div class="widget-head">
<div class="pull-left">Expense Information </div>
<div class="widget-icons pull-right"> </div>
<div class="clearfix"></div>
</div>
<div class="widget-content">
<div class="padd">
<!-- Form starts. -->
<form class="form-horizontal" id="form-upload" enctype="multipart/form-data" method="POST"/>
<div class="col-md-10">
<div class="form-group">
<label class="col-md-3 control-label">Work Order No. / काम संख्या </label>
<div class="col-md-9">
<select class="form-control" id="expenseworkorder">
<option>--Select Work Order</option>
</select>
<!-- <p id="lblexpenseworkorder" style="color:red; font-weight:bold; display:none;">Please enter Work Order No.</p>
--> </div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Date / तिथि </label>
<div class="col-md-9">
<input type="text" class="form-control eee" id="dateexpense"/>
<!-- <p id="lbldateexpense" style="color:red; font-weight:bold; display:none;">Please Choose Date</p>
--> </div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Name / नाम </label>
<div class="col-md-9">
<select class="form-control" id="expensename">
</select>
<!-- <p id="lblexpensename" style="color:red; font-weight:bold; display:none;">Please enter username</p>--> </div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Branch / शाखा </label>
<div class="col-md-9">
<input type="text" class="form-control eee" id="expensebranch"/>
</div>
</div>
<div class="form-group expen">
<label class="col-md-12 control-label">
<h1 style="color:#000; text-align:center;"><b>Expense Details</b></h1>
</label>
</div>
<div class="form-group">
<label class="col-md-3 control-label"> </label>
<div class="col-md-2">
<label class="control-label"> Amount</label>
</div>
<div class="col-md-2">
<label class="control-label"> Description</label>
</div>
<div class="col-md-4"> </div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Fuel / ईंधन</label>
<div class="col-md-2">
<input type="text" class="form-control eee" id="expensefuel"/>
<!-- <p id="lblexpensefuel" style="color:red; font-weight:bold; display:none;">Please enter Expense Details</p>
--> </div>
<div class="col-md-2">
<input type="text" class="form-control eee" id="expensefuel1"/>
<p id="lblexpensefuel1" style="color:red; font-weight:bold; display:none;">Please enter Expense Details</p>
</div>
<div class="col-md-4">
<div id="uploadContainer">
<input type="file" name="fuelfile[]" id="fuelfile0" class="inputfile inputfile-1" data-multiple-caption="{count} files selected" multiple="" style="border: transparent !important;" accept="image/*" capture="camera">
</div>
<input type ="button" id='extraUpload' value="Add another file" class="btn btn-default btn-md">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Food Allowance / भोजन भत्ता</label>
<div class="col-md-2">
<input type="text" class="form-control eee" id="foodallowance"/>
<!-- <p id="lblfoodallowance" style="color:red; font-weight:bold; display:none;">Please enter Food Allowance</p>
--> </div>
<div class="col-md-2">
<input type="text" class="form-control eee" id="expensefuel2"/>
<p id="lblexpensefuel2" style="color:red; font-weight:bold; display:none;">Please enter Expense Details</p>
</div>
<div class="col-md-4">
<div id="uploadContainerfood">
<input type="file" name="foodallowance[]" id="foodallowancefiles0" class="inputfile inputfile-1" data-multiple-caption="{count} files selected" multiple="" style="border: transparent !important;" accept="image/*" capture="camera">
</div>
<input type ="button" id='extraUploadfood' value="Add another file" class="btn btn-default btn-md">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Bus/Train Tickets / बस/रेल टिकट </label>
<div class="col-md-2">
<input type="text" class="form-control eee" id="expenseticket"/>
</div>
<div class="col-md-2">
<input type="text" class="form-control eee" id="expensefuel3"/>
<!-- <p id="lblexpensefuel3" style="color:red; font-weight:bold; display:none;">Please enter Expense Details</p>
--> </div>
<div class="col-md-4">
<div id="uploadContainerbus">
<input type="file" name="bus[]" id="bus0" class="inputfile inputfile-1" data-multiple-caption="{count} files selected" multiple="" style="border: transparent !important;" accept="image/*" capture="camera">
</div>
<input type ="button" id='extraUploadbus' value="Add another file" class="btn btn-default btn-md">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Room Allowance / कमरा भत्ता</label>
<div class="col-md-2">
<input type="text" class="form-control eee" id="roomallowance"/>
<!-- <p id="lblroomallowance" style="color:red; font-weight:bold; display:none;">Please enter Room Allowance</p>
--> </div>
<div class="col-md-2">
<input type="text" class="form-control eee" id="expensefuel4"/>
<!-- <p id="lblexpensefuel4" style="color:red; font-weight:bold; display:none;">Please enter Expense Details</p>
--> </div>
<div class="col-md-4">
<div id="uploadContainerroom">
<input type="file" name="roomallow[]" id="roomallow0" class="inputfile inputfile-1" data-multiple-caption="{count} files selected" multiple="" style="border: transparent !important;" accept="image/*" capture="camera">
</div>
<input type ="button" id='extraUploadroom' value="Add another file" class="btn btn-default btn-md">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Local Transportation / स्थानीय परिवहन</label>
<div class="col-md-2">
<input type="text" class="form-control eee" id="localtransport"/>
<!-- <p id="lbllocaltransport" style="color:red; font-weight:bold; display:none;">Please Enter Local Transportation</p>
--> </div>
<div class="col-md-2">
<input type="text" class="form-control eee" id="expensefuel5"/>
<p id="lblexpensefuel5" style="color:red; font-weight:bold; display:none;">Please enter Expense Details</p>
</div>
<div class="col-md-4">
<div id="uploadContainerlocal">
<input type="file" name="local[]" id="local0" class="inputfile inputfile-1" data-multiple-caption="{count} files selected" multiple="" style="border: transparent !important;" accept="image/*" capture="camera">
</div>
<input type ="button" id='extraUploadlocal' value="Add another file" class="btn btn-default btn-md">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Toll Tax / टोल टैक्स</label>
<div class="col-md-2">
<input type="text" class="form-control eee" id="tolltax"/>
<p id="lbltolltax" style="color:red; font-weight:bold; display:none;">Please enter Toll Tax</p>
</div>
<div class="col-md-2">
<input type="text" class="form-control eee" id="expensefuel6"/>
<!-- <p id="lblexpensefuel6" style="color:red; font-weight:bold; display:none;">Please enter Expense Details</p>
--> </div>
<div class="col-md-4">
<div id="uploadContainertoll">
<input type="file" name="toll[]" id="toll0" class="inputfile inputfile-1" data-multiple-caption="{count} files selected" multiple="" style="border: transparent !important;" accept="image/*" capture="camera">
</div>
<input type ="button" id='extraUploadtoll' value="Add another file" class="btn btn-default btn-md">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Angle/Fabrication / कोण/छलरचना</label>
<div class="col-md-2">
<input type="text" class="form-control eee" id="angelfabricate"/>
<!-- <p id="lblangelfabricate" style="color:red; font-weight:bold; display:none;">Please enter Angle/Fabrication</p>
--> </div>
<div class="col-md-2">
<input type="text" class="form-control eee" id="expensefuel7"/>
<p id="lblexpensefuel7" style="color:red; font-weight:bold; display:none;">Please enter Expense Details</p>
</div>
<div class="col-md-4">
<div id="uploadContainerangel">
<input type="file" name="angle[]" id="angle0" class="inputfile inputfile-1" data-multiple-caption="{count} files selected" multiple="" style="border: transparent !important;" accept="image/*" capture="camera">
</div>
<input type ="button" id='extraUploadangel' value="Add another file" class="btn btn-default btn-md">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Material Purchase / खरीद सामग्री</label>
<div class="col-md-2">
<input type="text" class="form-control eee" id="materialpurchase"/>
<!-- <p id="lblmaterialpurchase" style="color:red; font-weight:bold; display:none;">Please enter Material Purchase</p>
--> </div>
<div class="col-md-2">
<input type="text" class="form-control eee" id="expensefuel8"/>
<p id="lblexpensefuel8" style="color:red; font-weight:bold; display:none;">Please enter Expense Details</p>
</div>
<div class="col-md-4">
<div id="uploadContainermaterial">
<input type="file" name="material[]" id="material0" class="inputfile inputfile-1" data-multiple-caption="{count} files selected" multiple="" style="border: transparent !important;" accept="image/*" capture="camera">
</div>
<input type ="button" id='extraUploadmaterial' value="Add another file" class="btn btn-default btn-md">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Telephone / टेलीफोन</label>
<div class="col-md-2">
<input type="text" class="form-control eee" id="telephone"/>
<p id="lbltelephone" style="color:red; font-weight:bold; display:none;">Please enter Telephone</p>
</div>
<div class="col-md-2">
<input type="text" class="form-control eee" id="expensefuel9"/>
<p id="lblexpensefuel9" style="color:red; font-weight:bold; display:none;">Please enter Expense Details</p>
</div>
<div class="col-md-4">
<div id="uploadContainertelephone">
<input type="file" name="telephone[]" id="telephonefiles0" class="inputfile inputfile-1" data-multiple-caption="{count} files selected" multiple="" style="border: transparent !important;" accept="image/*" capture="camera">
</div>
<input type ="button" id='extraUploadtelephone' value="Add another file" class="btn btn-default btn-md">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Other Expense Details / अन्य विस्तार</label>
<div class="col-md-2">
<input type="text" class="form-control eee" id="otherexpensesdetails"/>
<p id="lblotherexpensesdetails" style="color:red; font-weight:bold; display:none;">Please enter Other Expense Details</p>
</div>
<div class="col-md-2">
<input type="text" class="form-control eee" id="expensefuel10"/>
<!-- <p id="lblexpensefuel10" style="color:red; font-weight:bold; display:none;">Please enter Expense Details</p>
--> </div>
<div class="col-md-4">
<div id="uploadContaineroth">
<input type="file" name="file-1[]" id="file-10" class="inputfile inputfile-1" data-multiple-caption="{count} files selected" multiple="" style="border: transparent !important;" accept="image/*" capture="camera">
</div>
<input type ="button" id='extraUploadoth' value="Add another file" class="btn btn-default btn-md">
</div>
</div>
<div class="form-group">
<label class="col-md-3 control-label">Total</label>
<div class="col-md-2">
<input type="text" class="form-control eee" id="totals" disabled="disabled"/>
</div>
<div class="col-md-2"> </div>
<div class="col-md-4"> > </div>
</div>
</div>
<div class="form-group">
<div class="col-md-8">
<button type="button" class="btn btn-default aa" id="btn_submitexpense"><b>Submit</b></button>
<img src="<?php echo base_url();?>assets/img/spin.gif" height="55px;" id="spinwait"/> </div>
</div>
</form>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
<!--/ Matter ends -->
</div>
Когда я загружаю больше одного файла изна мобильном телефоне, тогда все переменные в форм-данных показывают меня пустым в консоли, но хорошо работают в настольном браузере ...
Я застрял в этой ситуации за последние 2 дня, любая помощь приветствуется