Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $(document).ready(function() {
- // hice el submit desde un botón,
- // para que sea más fácil saber cuando se hayan agregado otros files
- $('#submit').on('click', function(e) {
- e.preventDefault();
- var fileName = $(this)
- .val()
- .split('\')
- .pop();
- // obtenemos los input file con la clase '.file-upload'
- var $inputsFile = $('.file-upload');
- var formData = new FormData();
- $inputsFile.each(function(index) {
- // hacemos el append a formData
- formData.append('file' + index, $(this)[0].files[0]);
- });
- $.ajax({
- url: '/script/Guardar_Archivos.ashx',
- type: 'POST',
- data: formData,
- cache: false,
- contentType: false,
- processData: false,
- success: function() {
- alert('Archivo subido con exito');
- },
- error: function(err) {
- alert(err.statusText);
- }
- });
- });
- });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement