我正在努力做的事情是:
uploadify.php
$targetFolder = 'uploads';
if (!empty($_FILES)) {
$tempFile = $_FILES['Filedata']['tmp_name'];
$targetPath = $targetFolder;
$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';
} else {
echo 'Invalid file type.';
}
}
的Javascript
jQuery('#file_upload').uploadify({
'swf' : plug+'/uploadify-v3.1/uploadify.swf',
'uploader' : plug + '/uploadify-v3.1/uploadify.php'
// Put your options here
});
我将如何做到这一点?
答案 0 :(得分:0)
您可以使用3个事件:
我建议您使用onuploaderror
并更改php脚本的返回码以匹配,以便它只处理错误。