File "custom_upload02.html"
Full Path: /home/analogde/www/Prog/File explorer/custom_upload02.html
File size: 971 bytes
MIME-type: text/html
Charset: utf-8
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.7.1/jquery.min.js"></script>
<script>
$('#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: 'custom_envoi.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
}
});
});
</script>
<input id="sortpicture" type="file" name="sortpic" />
<button id="upload">Upload</button>