我知道这个问题已经有一些线程,但没有一个对我有帮助。Uploadify - onComplete || onAllComplete不工作
我有一个图像管理器,我想用“onComplete”事件重新加载页面,但它不适用于我。
你可以看到一个例子:http://graficnova.com/uploadifytest/imgLoader.php
一切工作成功!!,但你需要刷新:(按F5键
THX和对不起我的英语
代码!
头:
<script type="text/javascript">
$(function() {
$("#fileInput").uploadify({
width : 100,
swf : 'swf/uploadify.swf',
uploader : 'php/uploadify.php',
queueID : 'imgloadList',
oncomplete : function() {
alert('hello world?'); //<- THIS NOT WORK
}
});
});
</script>
PHP: uploadify.php
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
//$targetPath = $_SERVER['DOCUMENT_ROOT'] . $targetFolder;
$targetPath = 'xxxxx/xxxx/xxxx/xxxx';
$targetFile = rtrim($targetPath,'/') . '/' . $_FILES['Filedata']['name'];
// Validate the file type
$fileTypes = array('jpg','jpeg','gif','png'); // File extensions
$fileParts = pathinfo($_FILES['Filedata']['name']);
if (in_array($fileParts['extension'],$fileTypes)) {
move_uploaded_file($tempFile,$targetFile);
echo '1'; //<- return response
} else {
echo 'Invalid file type.'; //<- return response
}
}
http://www.uploadify.com/documentation/uploadify/onqueuecomplete/ – hardba11