views:

43

answers:

0

hi very good,

I want to summarize what I send the image, ie the input file, does not reach the addimagen.php file, and sure it's a javascript problem, because with php alone, if you do it right.

I would like to know because I sent all the information I have the form, I have been doing some checks and not sending me and why it shows me the error message is because the "input type file" not recognized, I would like I have to know how to build the javascript code to do it for me. I use jquery with jquery.validate.js. Of course validations makes me well

    <script type="text/javascript">
$(document).ready(function() {
$.validator.addMethod("regex",function(value,element,regexp){
                    var re= new RegExp(regexp);
                    return this.optional(element) || re.test(value);
                },"Solo caracteres alfanumericos");                           
$("#image_upload").validate({ 
errorContainer:"#messageBox, .messageerror",
errorLabelContainer: "#messageBox",
wrapper: "li",debug:true,


 rules:{
                            gallery:{
                                required:true


                            },
                            uploadfile:{
                                required:true
                            },
                            Caption:{
                                required:true
                            },
                            Colour:{

                               required:true
                            },
                            Comentario:{
                                required:true
                            }

                    },
                    messages:{
                        gallery:{
                            required:"Nombre de la Galeria es obligatorio.",

                        },
                        uploadfile:{
                            required:"Debes añadir una imagen."
                        },
                        Caption:{
                            required:"Debes añadir un Nombre a la Imagen."
                        },
                        Colour:{
                            required:"El Color de Fondo es Obligatorio."
                        },
                        Comentario:{
                            required:"Deber añadir una Descripcion o Comentario."
                        }

                    },

submitHandler: function(form) {
                // do other stuff for a valid form
                $.post('addimagen.php', $("#image_upload").serialize(), function(data) {
                    $('.men').html(data);
                });
            }

});
});   
</script>

thank you very much and hope you can help me