Last active
November 8, 2016 08:55
-
-
Save aavrug/2d7af40e487920d2081d085853f6814c to your computer and use it in GitHub Desktop.
Upload File using ist and use that into PHP method
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//js code | |
$('.file-field:file').on('change', function() { | |
var file_data = this.files[0]; | |
var form_data = new FormData(); | |
form_data.append('file', file_data); | |
var formUrl = 'upload.php'; | |
$.ajax({ | |
url: formUrl, | |
dataType: 'text', | |
cache: false, | |
contentType: false, | |
processData: false, | |
data: form_data, | |
type: 'post', | |
success: function(response){ | |
console.log(response); | |
} | |
}); | |
}); | |
//php code | |
public function save_file_data() | |
{ | |
// logic over here | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment