簡體   English   中英

致命錯誤:調用未定義的方法UploadHandler

[英]Fatal Error: Call to undefined method UploadHandler

我正在使用jQuery File Upload,並且只將UploadHandler()類的位置從HOME/server/php/UploadHandler.phpHOME/index.php但出現此錯誤:

index.php:1438: Fatal Error: Call to undefined method UploadHandler::get_file_object [array_map]

我的index.php:

<?php

error_reporting(E_ALL | E_STRICT);

class UploadHandler
{
    protected $options;

    // PHP File Upload error message codes:
    // http://php.net/manual/en/features.file-upload.errors.php
    protected $error_messages = array(

    etc....

    protected function get_file_object($file_name) {
        if ($this->is_valid_file_object($file_name)) {
            $file = new stdClass();
            $file->name = $file_name;
            $file->size = $this->get_file_size(
                $this->get_upload_path($file_name)
            );
            $file->url = $this->get_download_url($file->name);
            foreach($this->options['image_versions'] as $version => $options) {
                if (!empty($version)) {
                    if (is_file($this->get_upload_path($file_name, $version))) {
                        $file->{$version.'Url'} = $this->get_download_url(
                            $file->name,
                            $version
                        );
                    }
                }
            }
            $this->set_additional_file_properties($file);
            return $file;
        }
        return null;
    }

    etc...

    protected function get_file_objects($iteration_method = 'get_file_object') {
        $upload_dir = $this->get_upload_path();
        if (!is_dir($upload_dir)) {
            return array();
        }
        return array_values(array_filter(array_map(
            array($this, $iteration_method),
            scandir($upload_dir)
        )));
    }

}

$upload_handler = new UploadHandler();

?>

感謝您的任何幫助!

將此功能設為“靜態”

protected function get_file_object($file_name) {

protected static function get_file_object($file_name) {

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM