php mysql ajax register form with image upload -


hello brothers ask how can make registration form image upload(base64) usign php mysql ajax , part of code didn't work. wish if tell me type of table row , give me righ code this.

$("#dsubmit").click(function(){     var formdata = new formdata(this);     demail=$("#demail").val();     dpassword=$("#dpassword").val();     dfirstname=$("#dfirstname").val();     dlastname=$("#dlastname").val();     dtel=$("#dtel").val();     dadr=$("#dadr").val();     dspeciality=$("#dspeciality").val();     dcodepost=$("#dcodepost").val();      $.ajax({         type: "post",         url: "inc/regdoc.php",         data: formdata,"&demail="+demail+"&dpassword="+dpassword+"&dfirstname="+dfirstname+"&dlastname="+dlastname+"&dtel="+dtel+"&dadr="+dadr+"&dspeciality="+dspeciality+"&dcodepost="+dcodepost,         async: false,         cache: false,         contenttype: false,         processdata: false,         success: function(html){             if(html=='true') {                 $("#dmsg_box_connexion").css("color","green");                 $("#dmsg_box_connexion").html("utilisateur ajouté avec succés ! redirection ...");                 window.settimeout(function(){window.location.href = "index.php";}, 5000);             } else {                  $("#dmsg_box_connexion").html("s'il vous plaît remplir tous les champs");             }         },         beforesend:function() {             if((demail == "")||(dfirstname == "")||(dlastname == "")||(dtel == "")||(dpassword == "")||(document.getelementbyid("dfile").value == "")||(dcodepost == "")||(dadr == "")) {                 $("#dmsg_box_connexion").css("color","red");                 $("#dmsg_box_connexion").html("tous les champs sont obligatoires !");                 return false;             }              $("#dmsg_box_connexion").css("clor", "#32b1d3");             $("#dmsg_box_connexion").html("validation...");         }     });     return false; }); 

});

and php file :

session_start(); $email = addslashes(htmlentities($_post["demail"])); $password = addslashes(htmlentities($_post["dpassword"])); $firstname = addslashes(htmlentities($_post["dfirstname"])); $lastname = addslashes(htmlentities($_post["dlastname"])); $codepost = addslashes(htmlentities($_post["dcodepost"])); $adresse = addslashes(htmlentities($_post["dadr"])); $tel = addslashes(htmlentities($_post["dtel"])); $speciality = addslashes(htmlentities($_post["dspeciality"])); $get_content = file_get_contents($_files['dfile']['tmp_name']); $escape = mysql_real_escape_string($get_content); $sourcepath = $_files['dfile']['tmp_name'];   // storing source path of file in variable $targetpath = "uploads/".$_files['dfile']['name'];  // target path file stored move_uploaded_file($sourcepath,$targetpath) ; //  moving uploaded file   $pass = sha1($password); include ('pgs/config.php'); $insert = $bdd->query("insert tbl_docs values      ('','$firstname','$lastname','$tel','$adresse','$speciality','$email','$pass','$escape','1','$codepost')"); if($insert == 1) {     echo 'true'; } else {     echo 'false'; } 

and th form header:

<form id="d" method="post" action="#inc/regdoc.php" enctype="multipart/form-data"> 


Comments

Popular posts from this blog

ruby on rails - RuntimeError: Circular dependency detected while autoloading constant - ActiveAdmin.register Role -

c++ - OpenMP unpredictable overhead -

javascript - Wordpress slider, not displayed 100% width -