currently using ajax formdata sending file in ajax . json give me output file name not full path of image .let me know how can image full path , image upload in folder .
//code here
<?php if(isset($_post)){ $data = $_files['file-0']['name']; $file = 'upload/'. $_files['file-0']['name']; $success = file_put_contents($file, $data); json_encode($data); } ?> <script> $(".btnsubmit").click(function(){ var data = new formdata(); jquery.each(jquery('.inputfile')[0].files, function(i, file) { data.append('file-'+i, file); }); $.ajax({ type: 'post', url: 'check.php', contenttype: false, processdata: false, data: data }) .done(function(data){ $(".response").html("<img src="+data+">"); }) .fail(function() { // in case posting form failed alert( "posting failed." ); }); // prevent refreshing whole page page return false; }); </script>
Comments
Post a Comment