im trying to work/modify with a class i downloaded. sadly im not getting it. I have yahoogled oop and its not making me any wiser.
can some one explain please what i shold be doing?

first of all the classes have a number of vars in the original form like so being the one i want to use

public $fullPath= DD_DIR;   
    public $fileToDownload = 'ajax-loader.gif'; // File to download listed in the 'download' directory

ok so as i understood i have to construct to use a post value. i did this

function __construct() {
        $this-> $fileToDownload = $_POST['image_name'];
    }

    and changed the var to

    public $fileToDownload ; 

All the wheels fell off, and nothing get displayed on the page that includes the class. and I hoped some one would give me a jump start.

Recommended Answers

All 12 Replies

thank you i had read it but my problem still confounds me

it looks to me that i used __construct as you did in your case

function __construct() { $this->colour = 'white';

so i am sure i am doing something fundamentaly wrong, just cant see it

$this-> $fileToDownload = $_POST['image_name'];

should be:

$this->fileToDownload = $_POST['image_name'];

hA!! thank you i got totally frustrated with it , on the verge of passsing on OOp yest again . ill keep going :)

page showing but downloading 'quote' download not the image name i put in the form
so this must be wrong?

`public $fileToDownload = 'ajax-loader.gif'; // File to download listed in the 'download'

changed to public $fileToDownload `

You constructor overwrites that with the POSTed name, so what filename is in there?

i posted a file 3.jpg but download shows just download no actual file as such

download shows just download no actual file as such

Explain. I do not understand what you mean.

it shows a download alert (windows) with the usual open or save options but shows the file as 'download' no extension shown

You should removed $ before file download. It should
->filedownload =....

@mushfik thank yu for answering pritaeas already saw that rookie mistake :)

I hit fruther problems testing this, the download error caused a download of something and it caused wamp to just keep downloading to the point it crashed my harddrive . took me a while to see the problem as i thougt i had a drive corrupted but will try again today with bettr explanation
im feeling as dumb as a bag of hammers at the moment :)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.