
No funciona POST
Publicado por leamax71 (2 intervenciones) el 20/07/2016 17:44:53
Buen día amigos, tengo un problemilla que seguro me van a saber dar una solución. Al intentar enviar un archivo de a.html a b.php no funciona el POST del FORM aunque al chequear con Javascript antes de enviar se puede comprobar que el INPUT no está vacío...
a.html
b.php
Desde ya muchas gracias!!!!!!!!!!!!!!!!!
a.html
1
2
3
4
<form id="form_foto_taza" method="post" enctype="multipart/form-data" action="b.php">
<input type="file" class="file" id="foto_taza" name="foto_taza" />
<button class="btn btn-default btn-sm" id="boton_subir">Confirmar</button>
</form>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
<script type="text/javascript">
$(document).ready(function(){
$("#boton_subir").bind("click", function(event){
event.preventDefault();
var img = $("#foto_taza").val();
if (img === '') {
alert("Faltó seleccionar una foto");
return false;
}else{
$("#form_foto_taza").submit();
}
});
});
</script>
b.php
1
2
3
$img = (isset($_POST['foto_taza'])) ? $_POST['foto_taza'] : NULL;
if($img === NULL){ echo"WTF"; die(); }
Desde ya muchas gracias!!!!!!!!!!!!!!!!!
Valora esta pregunta


0