1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47
| <!DOCTYPE HTML>
<html>
<head>
<meta charset="utf-8">
<meta name="description" content="">
<meta name="keywords" content="">
<title>BBCode</title>
<link rel="shortcut icon" type="image/x-icon" href="./favicon.png">
<link rel="icon" type="image/x-icon" href="./favicon.png" />
</head>
<body>
<div id="maDiv"></div>
<br />
<textarea id="myTextarea" name="description" style="height:300px;width: 923px;"></textarea>
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>
var textarea = document.getElementById("myTextarea");
textarea.addEventListener("dragover", function(e) {
e.preventDefault();
});
textarea.addEventListener("drop", function(e) {
e.preventDefault();
var file = e.dataTransfer.files[0];
var formData = new FormData();
formData.append("file", file);
fetch("upload.php", {
method: "POST",
body: formData
});
$.post("upload.php" ,{ url:$(this).val() } ,function(data){
var maDiv = document.getElementById("maDiv");
maDiv.innerHTML = data;
});
});
</script>
</body>
</html> |
Partager