TalkPHP
 
 
Account Login
Latest Articles
» The basic usage of PHPTAL, a XML/XHTML template library for PHP
» Vulnerable methods and the areas they are commonly trusted in.
» Simple way to protect a form from bot
» The Basics On: How Session Stealing Works
» How to keep your forms from double posting data
IRC Channel
IRC Speech Bubble Join the friendly bunch on IRC...
(#TalkPHP on Freenode)

...Also available via a web interface.

See this thread for information on the TalkPHP Free Hugs Initiative™. Subject to availability.
Associates
Associates
CSS Tutorials
Reply
 
LinkBack Thread Tools Search this Thread Display Modes
Old 11-11-2008, 03:33 PM   #1 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default Gallery problem

Hi!

I've hit a problem:

php Code:
public function uploadImage($szInputName)
    {
       
        $this->form_inputName = $szInputName;
       
        // If the neccessary stuff has been set
        if(isset(parent::$path) && isset($this->user))
        {
            //I'm doing some stuff here..
           
        }
       
        else throw new Exception('Everything is not set yet.');
       
    }

php Code:
include('Gallery.php');
    include('Upload.php');
   
    $allowed = array(
   
        'jpeg',
        'gif',
        'png'
   
    );
   
    try
    {
       
        $gallery = new Gallery(NULL, 'images/');
        $gallery->setAllowedTypes($allowed);
        $gallery->setLimitFileType('no');
        $gallery->setThumbSize(400, 600);
        $gallery->setMaxFileSize(100000);
       
        $upload = new Upload(2);
        $upload->uploadImage('filename');
       
    }
   
    catch(Exception $error)
    {
       
        echo $error->getMessage();
       
    }

Gives me:
Code:
Everything is not set yet.
Which means that either path is not set, or the user id is not set.

And you can see that I've set both userid:
PHP Code:
$upload = new Upload(2); 
and the path:
PHP Code:
$gallery = new Gallery(NULL'images/'); 
So I'm thinking that perhaps this is wrong:
PHP Code:
parent::$path 
Is that an incorrect way of doing it?
Haven't worked much with parents and stuff..

The path variable in the gallery class(which the upload class extends) is set to protected.

Any ideas why this error is thrown?
__________________
Tanax is offline  
Reply With Quote
Old 11-11-2008, 04:08 PM   #2 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

Actually, I already figured it out.

It's because $upload is a completely new object of the gallery.. hmm.. so everything I set with the $gallery is not kept to the $upload ..

So anyone have any idea how to solve this nicely? Cause I would really like to have a seperate class for the uploads and have the gallery as a core.

Should I make the "core" static?
__________________
Tanax is offline  
Reply With Quote
Old 11-13-2008, 07:09 PM   #3 (permalink)
The Prestige
Upcoming Programmer Inquisitive 
 
Tanax's Avatar
 
Join Date: Sep 2007
Location: Sweden, Stockholm
Posts: 1,080
Thanks: 115
Tanax is on a distinguished road
Default

Hehe, nevermind. I solved this xD
__________________
Tanax is offline  
Reply With Quote
Reply



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


All times are GMT. The time now is 02:27 PM.

 
     

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.
Search Engine Optimization by vBSEO 3.1.0
Inactive Reminders By Icora Web Design