Read files from database?

43 views
Skip to first unread message

Tr pass

unread,
May 9, 2015, 1:59:27 PM5/9/15
to jquery-f...@googlegroups.com
I am trying to create custom class for the plugin. I succeeded inserting data to my database however I can't read files from the database. Since I am not very familiar with object oriented programming I couldn't figure out where is the problem. Also there is not enough documentation for that.
class CustomUploadHandler extends UploadHandler {

    public function get($print_response = true) {

        $db = new DB;
        $query = $db->get_rows("SELECT * FROM `files` ORDER BY `name`");

        foreach ($query as $row)
            {   
                $file = new stdClass();
                $file->id = $row->id;
                $file->name = $row->name;
                $file->size = $row->size;
                $file->type = $row->type;
                $file->title = $row->title;
                $file->url = $row->url;
                $file->thumbnail_url = $row->thumbnail;
                $file->delete_url = "";
                $file->delete_type = "DELETE";
             }

         return $this->generate_response($query, $print_response);
    }

}
Reply all
Reply to author
Forward
0 new messages