Цитата:
<script>
$(document).ready(function(){
$('#file').bind('change', function(){
var data = new FormData();
jQuery.each($('#file')[0].files, function(i, file) { data.append('file-'+i, file); });
$.ajax({
url: 'blank.php',
data: data,
cache: false,
contentType: false,
processData: false,
type: 'POST'
});
})
});
</script>
</head>
<body>
<input id='file' type='file' name='1'/>1</input>
<input id='file' type='file' name='2'/>2</input>
$(document).ready(function(){
$('#file').bind('change', function(){
var data = new FormData();
jQuery.each($('#file')[0].files, function(i, file) { data.append('file-'+i, file); });
$.ajax({
url: 'blank.php',
data: data,
cache: false,
contentType: false,
processData: false,
type: 'POST'
});
})
});
</script>
</head>
<body>
<input id='file' type='file' name='1'/>1</input>
<input id='file' type='file' name='2'/>2</input>
Файлы грузятся только через первый input, а через второй не хотят, как указать правильно #id