Guten Tag Forum,
das ist mein gesamter Code:
|
Source code
|
1
2
3
4
5
6
7
8
|
foreach($_FILES["upload"]["name"] as $key => $value)
{
$time_var=time();
$file_tmp=$_FILES['upload']['tmp_name'][$key];
$file_new='gehtup/'.$time_var.'_'.$_FILES['upload']['name'][$key];
move_uploaded_file($file_tmp,$file_new);
}
|
|
Source code
|
1
2
3
|
$arr = apc_fetch("upload_{$_GET['uid']}");
//printf("<pre>%s</pre>", print_r($arr,true));
print(round(($arr['current']*100)/$arr['total'],1)."% uploaded");
|
|
Source code
|
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
|
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" dir="ltr" xml:lang="de">
<head>
<title>APC Upload</title>
<script type="text/javascript">
function ajax(uid) {
var req;
try {
req = window.XMLHttpRequest?new XMLHttpRequest():
new ActiveXObject("Microsoft.XMLHTTP");
} catch (e) {
//Kein AJAX Support
}
req.onreadystatechange = function() {
if ((req.readyState == 4) && (req.status == 200)) {
document.getElementById("status").innerHTML = req.responseText;
}
}
req.open('GET', 'status.php?uid='+uid, true);
req.send("");
}
</script>
</head>
<body>
<iframe src="upload.php" name="hidden_upload" style="display:show"></iframe>
<div id="status"></div>
<form action="upload.php" name="upload" target="hidden_upload" method="post" enctype="multipart/form-data">
<div>
<input type="hidden" name="APC_UPLOAD_PROGRESS" value="<?php echo uniqid();?>"/>
<input type="file" name="upload[]" multiple />
<input type="submit" onclick="this.disabled=false; setInterval('ajax(\''+this.form.APC_UPLOAD_PROGRESS.value+'\')', 750); "/>
</div>
</form>
</body>
</html>
|
Das Problem ist nur die Files kommen auch an, aber ich bekomme einfach meine Prozente nicht angezeigt bzw. nur ganz am Ende 100% und das wars.
Danach faengt erst das JS an die Requestst zu senden.
Hoffe Ihr koennt mir da helfen.
Mfg Patrick