Jump to content


Photo

Download script problem

help

  • Please log in to reply
3 replies to this topic

#1 kayz100

kayz100

    Advanced Member

  • Members
  • PipPipPip
  • 34 posts

Posted 25 February 2013 - 02:57 AM

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
kay98kl@yahoo.com

#2 requinix

requinix

    Transforming Moderator

  • Moderators
  • 6,150 posts
  • LocationWA

Posted 25 February 2013 - 03:31 AM

Your website is not running PHP 5.3. Can you upgrade it?

#3 kayz100

kayz100

    Advanced Member

  • Members
  • PipPipPip
  • 34 posts

Posted 25 February 2013 - 08:04 AM

I am with 1and1, have no idea what sort of PHP they are running. Do you have an idea of download_path? I am really stuck on this mate

#4 requinix

requinix

    Transforming Moderator

  • Moderators
  • 6,150 posts
  • LocationWA

Posted 25 February 2013 - 01:25 PM

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

define( "DOWNLOAD_ROOT",    __DIR__ . "/" );
__DIR__ is for PHP 5.3+ only. For <5.3 you can use
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.




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users

Cheap Linux VPS from $5
SSD Storage, 30 day Guarantee
1 TB of BW, 100% Network Uptime

AlphaBit.com