upload file using jQuery try this code on your Local server.
Select image file and store in a variable and pass the value in the other URL link where you type you insert query. For example:
var select_file = $('#resume_file').val().split(".").pop().toLowerCase(); if(select_file == "png" || resume_file1 == "jpg" || resume_file1 == "jpeg"|| resume_file1 == "gif"){ var file_data = $('#resume_file').prop('files')[0]; var form_data = new FormData(); form_data.append('file', file_data); var position=$('#position').val(); $.ajax({ url: 'file_submit.php', // point to server-side PHP script type: 'post', contentType: false, processData: false, data: form_data, success: function(res){ console.log(res); } });
Get file value in a PHP page and upload an image into database using insert query.
<?php $filename=$_FILES['file']['name'];
Question and answer is powered by AnsPress.io