-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathindex.php
More file actions
58 lines (43 loc) · 1.19 KB
/
index.php
File metadata and controls
58 lines (43 loc) · 1.19 KB
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
48
49
50
51
52
53
54
55
56
57
<?php
/**
* Created by PhpStorm.
* User: enriqueohernandez
* Date: 5/2/15
* Time: 12:19 PM
*/
?>
<html>
<head>
<title>
XLS to SQL
</title>
<script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.11.2.min.js"></script>
<script>
function myfunction(){
var file_data = $('#xls').prop('files')[0];
var form_data = new FormData();
form_data.append('file', file_data);
$.ajax({
url: 'fileHandler.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(respuesta){
//**HERE IS PRINTED THE SQL SNIPPET**
$("div").html( "<h3>" + respuesta + "</h3>");
}
});
}
</script>
</head>
<body>
<h1>XLS to SQL</h1>
<input id="xls" type="file" name="files" />
<button id="upload" onclick="myfunction()">Upload</button>
</form>
<div id="result1"></div>
</body>
</html>