Jump to content

Download script problem


kayz100

Recommended Posts

Hi Guys

 

Thanks for all the help. I managed to ficx my form issues and now I have another problem 'DOWNLOAD SCRIPT".

I think the main problem I have here is the directory for the download. Everything works fine on EasyPHP

 

development plartform at home but when I tried it on my mates site www.drumafrica.biz it outputs the follwing

 

error:

 

Notice: Use of undefined constant __DIR__ - assumed '__DIR__' in

 

/homepages/25/d423356896/htdocs/FTPweb/DRUM/MyDwnlods/index.php on line 5

 

I think i am failing to write the correct path (directory) for php to find live path, on the home server I

 

simply use "/" and it works.

 

I use Filezilla for FTPing. I nearly forgot I am using windows 7 and XP. All my PHP is tested on EasyPHP5. I

 

ahve indluded the script that I am having a problem with. Please log on to drumafrica.biz. The file will be on

 

there until tomorrow, tuesday 26th,pleae help thanks.

 

List of files inside MyDwnlds

1. index.php

2. downloadme.php

3. MyDownloads folder contains files to download

 

-------------- index.php code: ----------------

<?php

 

error_reporting(-1);

 

define( "DOWNLOAD_ROOT", __DIR__ . "/" ); //This is the problem

 

require_once("downloadme.php");

 

$download_path = DOWNLOAD_ROOT . "Mydownloads/";

$file = $_REQUEST['f'];

 

$args = array(

'download_path' => $download_path,

'file' => $file,

'extension_check' => TRUE,

'referrer_check' => FALSE,

'referrer' => NULL,

);

$download = new rocasa_download( $args );

 

$download_hook = $download->get_download_hook();

//$download->rocasa_print($download_hook);

//exit;

 

if( $download_hook['download'] == TRUE ) {

 

/* You can write your logic before proceeding to download */

 

/* Let's download file */

$download->get_download();

 

}

 

?>

 

Feel free to email me

[email protected]

Link to comment
https://forums.phpfreaks.com/topic/274912-download-script-problem/
Share on other sites

I'll take that as a "no" then.

 

define( "DOWNLOAD_ROOT",    __DIR__ . "/" );

__DIR__ is for PHP 5.3+ only. For

define( "DOWNLOAD_ROOT", dirname(__FILE__) . "/" );

 

You should install PHP 5.2 on your machine at home so there aren't any more of these problems.

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.