ajax file upload jquery
$('#upload').on('click', function() {
var file_data = $('#sortpicture').prop('files')[0];
var form_data = new FormData();
form_data.append('file', file_data);
alert(form_data);
$.ajax({
url: 'upload.php', // point to server-side PHP script
dataType: 'text', // what to expect back from the PHP script, if anything
cache: false,
contentType: false,
processData: false,
data: form_data,
type: 'post',
success: function(php_script_response){
alert(php_script_response); // display response from the PHP script, if any
}
});
});
Also in JavaScript:
- es6 array sum javascript
- how to display first value of an array in jquery
- how to check if json data is received in ajax response
- ctx.filltext font size
- how to draw a triangle using javascript
- Javascript get current year
- how to make apk react native
- javascript read database
- escape json in javascript
- see if discord message is in dm discord.js
- hex string to int javascript
- switch/case with numeric range
- data type angular
- react route props
- how to get all elements with same class in javascript
- db.json
- how to check string uppercase or lowersace using regex javascript
- javascript is undefined
- get the state of a checkbox
- adding int and string in react props
- jstl expects equals
- convert boolean to string javascript
- vue js default props
- promise js