2

我正在尝试通过 uploadify 上传大型视频文件,但是一旦文件变大(> 800MB),onUploadSuccess 事件move_uploaded_file就会在完成之前触发。有没有办法让 uploadify 等待实际成功,甚至在完成上传和实际成功之间显示某种等待消息(如“完成上传”或其他内容)?
这是我的upload.php的代码:

if($video = wire('pages')->get($_POST['id'])) {
if (!empty($_FILES)) {
    $tempFile = $_FILES['Filedata']['tmp_name'];
    $targetPath = $_SERVER['DOCUMENT_ROOT'] . $targetFolder;
    $targetFile = rtrim($targetPath,'/') . '/' . $_FILES['Filedata']['name'];
    $targetFile = preg_replace('/ /','_',$targetFile);
    // Validate the file type
    $fileTypes = array('mov','mp4','m4v'); // File extensions
    $fileParts = pathinfo($_FILES['Filedata']['name']);

    if (in_array($fileParts['extension'],$fileTypes)) {
        if(move_uploaded_file($tempFile,$targetFile)) {
            $file = preg_split("/\//", $targetFile);
            $video->filename = array_pop($file);
            $video->video_status = 'transcode';
            $video->addStatus('Page::statusUnpublished');
            $video->save();
            echo $video->filename." gespeichert";
        }
    } else {
        echo 'Invalid file type.';
    }
}
}

谢谢,
托马斯

4

0 回答 0