Ver Mensaje Individual
  #1 (permalink)  
Antiguo 25/09/2014, 13:05
WorseMzg
 
Fecha de Ingreso: noviembre-2013
Mensajes: 78
Antigüedad: 10 años, 5 meses
Puntos: 4
subir archivo con form data

buenas a todos,

mi problema es el siguiente

tengo un formulario simple
Código HTML:
<form id="formNuevoBoletin" method="post" action="includes/processNew.php" enctype="multipart/form-data" >
	
		
		<label>Titulo del Boletin:</label></td>
		<input type="text" name="titulo"></td>	
		

	
		<label>Selecciona el Archivo:</label></td>
		<input type="file" name="archivo"></td>
		
		
	
		<input type="hidden" name="tipo" value="<?php echo $tipo ?>">
		<input type="button" onclick="subir('boletin')" value="Subir"></td>
</form> 

ahora al momento de pasar por la funcion .... el error illegal invocation

el script es este


Código:
function subir(tipo){
	if (tipo=="boletin"){
		var formData = new FormData("#formNuevoBoletin");
		$.ajax({
				url: 'includes/processNew.php',
				type: 'POST',
				async: true,
				data: formData,
				success:  function (response) {
			             $("#respuesta").html(response);
			         }
			});
	};
}

me imagino que el problema es con el form data, de echo es la primera vez que lo ocupo y me quede estancado en esto ...

espero su ayuda gracias :D