gpt4 book ai didi

javascript - 上传-onComplete || onAllComplete 不起作用

转载 作者:行者123 更新时间:2023-12-02 19:20:37 26 4
gpt4 key购买 nike

我知道已经有一些帖子提出了这个问题,但没有一个对我有帮助。

我有一个图像管理器,我想使用“onComplete”事件重新加载页面,但它对我不起作用。

你可以看一个例子:http://graficnova.com/uploadifytest/imgLoader.php

一切正常!!,但你需要按 f5 键刷新它:(。

感谢并抱歉我的英语!

代码:

头:

<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
}

}

最佳答案

根据 Uploadify 文档,没有 onComplete 事件,但有一个 'onUploadComplete'事件:

Triggered once for each file when uploading is completed whether it was successful or returned an error. If you want to know if the upload was successful or not, it’s better to use the onUploadSuccess event or onUploadError event.

也许想尝试一下。或查看onQueueComplete .

关于javascript - 上传-onComplete || onAllComplete 不起作用,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/12572726/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com