Tracking Forums, Newsgroups, Maling Lists
Home Scripts Tutorials Tracker Forums
 
  HOME    TRACKER    PHP




Download Manager


Ive written quite a complex download manager using PHP MySQL and when the user clicks the download image i call a script like so download.php?file=[filename]

Ideally i would like the page to stay static, im pushing the file to the browser with a META TAG and the page goes blank, i cant redirect with an header(); because im using sessions and i get loads of errors.

Ive seen loads of download sites that dont need another page to redirect to, how do i keep the same page and allow the file to be downloaded.




View Complete Forum Thread with Replies

See Related Forum Messages: Follow the Links Below to View Complete Thread
Writing A Kind Of Download Manager In PHP
I'm writing a kind of download manager. Now the problem is that all the files are on different servers with different extensions.
I'm quite new (not totally) to PHP and I cant find the solution. I've tried headers, but they only work on same server as download.php.

Creating Download Manager For Multiple Files
Has anyone run across some sort of download manager to be able to download multiple files at a time via http with PHP? I run a mp3 site and I would like to be able to allow people to download whole folders at a time basically the same functionality as ftp but with http. It would be kind of like the smart download thing that netscape has but cross platform compatible. Any ideas?

Looking For A Highly Modular Time Manager/task Manager System
I'm looking for a highly modular time manager/task mananger which is
(of course!) written in PHP.

Any suggestions?

Btw. the system shall be open source developed under a GNU licence or
such as we - a web developing tem - plans to fiddle with the code and
integrate it in another to-come content management system...

Htaccess Manager?
I'm looking for a script that could administer htaccess scripts for
several folders. Our website has over a hundred folders which need
protection, and it would just fabulous if there was a script that could
make it all happen from the same front-end. The server is a
Windows-server, running php5. I've searched hotscripts.com, but all
there was were either for a single folder or just didn't work.

Looking For News Manager .
I'am looking for News Manager and Photo Gallery (.php & MySql).

Webhosting Manager App
I am tasked to develop an CPanel like web app and I am stuck.
Stuck at the start.
I've downloaded a few others open source control panel hosting apps
(vhcs, gplhost, virtualmin..etc) to give me inspiration. I know what
to include, but the problem is how to make it work.

I am not relatively new to linux, for i am using it since as an office
workstation for the past 4years. With the help of 'man' and 'google',
i am able to modify confs of different services.

the real question i am wanting to ask is how those amazing CP/WH
Managers able to modify the confs without 'root' or using a 'sudo'.

i am implementing it on a CentOS4 distro.

File Manager Acting Up?
The thing is that I'm developing a file manager at the moment, I'am however
having a couple of problems with opening directories and one other small
issue too.

Can anyone see the problems with this code :

if(!isset($filename))
{
$current_dir = getcwd();
$dh = opendir($current_dir);
while (false !== ($files = readdir($dh)))
{
$dir_listing[] = $files;
}
sort($dir_listing);
echo "<font color=white><b>CURRENT DIRECTORY:";
echo $current_dir;
echo "</b></font>";
}
else //this is the part where I'm having trouble, for the 2nd and susequent
changes of the dir.
{
chdir($filename);
$current_dir = getcwd();

//echo $filename, "<<filename
";
//$goTo = "$script_root/$filename";
//$goTo = "$current_dir/$filename";
//echo $goTo, "<<< go to is
";
//echo getcwd();
//$current_dir = getcwd();

$dh = opendir($current_dir);
while (false !== ($files = readdir($dh)))
{
$dir_listing[] = $files;
}
sort($dir_listing);
echo "<font color=white><b>CURRENT DIRECTORY:";
echo $current_dir;
echo "</b></font>";
}

$filename is the name of the directory to open and get info on it's files
and stuff. When I load filemanager.php, the directory it is installed into is used and everything works as normal, but then if I go to another directory such as .. everything works normal, however when I try to change back to the orig dir or to another dir from .. it trys to open it relavtive to the orig dir. I hope you know what I mean. Does anyone know how to fix this.

Also when I try to display the current_dir, in windows it works as expected
but on unix it gives my /home/.falcon/username/folder1/folder2.....
where does this ./falcon thing come from. I would use path_translated thingy
but it does not work on Windows systems.

FedEx Ship Manager API
I was was wondering if anyone had experience using FedEx's Shipping API's. Is their any online resources? From what I have seen (which isn't much) there are two APIs that I am interested in; one using XML; the other using a SDK developed in C. Either, I assume can be interfaced with using PHP.

Robust Session Manager
I'm trying to create a robust session manager which does not rely on PHP sessions. I'm aiming to put it online as a free script when it's polished.

The code below is designed to be included at the top of every page and uses the database table shown below. By relying on neither paths nor cookies this should be a more robust solution to PHP ecommerce. Links are written: http://www.domain.co.uk/page-script/pagename/session/

page-script = script to build page pagename = variable passed to page-script to load content from database (e.g. 'homepage' could be an index entry in a sitetext table) By adding an .htaccess file with:

<Files page-script>
ForceType application/x-httpd-php
</Files>

In the document root the rewriting is done automatically. This does not require any access to httpd.conf or mod_rewrite which many shared hosting users do not have. An added advantage is that it is search engine friendly, many search engines do not like indexing URLs which are clearly database driven, i.e. page.php?var=345&var2=4589 Anyone have suggestions/opinions on this method of tracking sessions? Code:

Error Msg Trying To Play With Sqlite Manager
error msg...
the procedure entry point spprintf could not be located in the dynamic link
library php4ts.dll

i dumped the contents of the download of sqlitemanager in a web server
directory.
at first it couldnt find the sqlite extension so i went to the php website
and retrieved one
and placed it in the extension directory. now i get this message and i dont
even have php4ts.dll
installed on my machine. i have a php4ts.lib i believe. i'm wondering
since the version of
php i have on my machine didnt already have this extension set up ready to
go maybe i need
a newer version.

php works fine on my machine when i am not trying to use this new program.

this sqlitemanager will give me a few more features that i wouldnt get
unless i bought sqliteplus.
programming is just a hobby for me and i dont make any money doing it.
right now i am learning tcl/tk with sqlite to practice making a gui
database. that is what led me to the
new sqlitemanager. there was an sqlite browser but that didnt let me
execute sqlite queries.

Database Manager Using Internet Browser
I'm trying to build a database manager, where I can edit and update my database using a web interface.

Reccomendations For A Good File Manager Script.
I would like a nice php based file manager script so when someone goes
to a directory they can see the contents and be able to download
files.

Currently my Apache can do this but the rows are limited to 25-30
characters long and that makes identification of files a little hard.

I know there are an array of files out there which is why i am asking
for recommendations. :)

Warning: SQL Error: [Microsoft][ODBC Driver Manager]
Cannot get an ODBC (or MSSQL) connection to MS Sql Server 7. Using a system datasource and it connects fine, but PHP does not like it. I've had no problem with NT4 but Win2K is another story...

Warning: SQL error: [Microsoft][ODBC Driver Manager] Data source name not found and no default driver specified, SQL state IM002 in SQLConnect in c:inetpubwwwrootindex.php on line 8

Is There Any Open Source Mailing List Manager That Works Good
I am searching for a good open source php mailing list manager for some days. can any one suggest me one please.

Looking For A Database-driven Email "contact Manager" Application
I'm going to be collecting lots (a few thousand) email addys. Each of
these people will be interested in recieving mail on one or more
topics, with an open ended and growing number of topics. Mailman with
a BD application behing it might be ideal as it would let users add
and delete themselves and each topic would have it's own email list
name identity.

Mailing List Manager, Send To List
I'm looking for a mailing list script (php) that has a function to let
users to reach out to all recipient on the list by simple send the
email to a specific maillist- address.

Mailman has this functionn but as a just got a webserver account I
can't use mailman nor install it.

Ftp Download Using Php
i need to implement a ftp download using php. i am using the ftp_get function to implement it. PHP Code:

Zip Download
please check this code i am trying to give users the ability to download zip
files

header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".$length);
header("Content-type: multipart/x-zip");
header('Content-Disposition: attachment; filename="'.$filename.'"');
readfile($filename);

but the zip file download and shows size 4 mb but there is no file in the
zip and it does not extract and says its corrupt i know its not corrupt because if i download the same file from ftp it works fine only downloading by using this code gives this error ...

Download Jpg
I need to see how to download a JPG directly without using zip files by example. If you click to donwload pictures you can download directly a JPG. They use PHP to do the trick, so my question is if somebody know how it can be done.

Download
I have a script that download any file to the user according to the
parameters.
I call the script like this:
download.php?file=xxx/myfile.doc&file_short=myfile.doc

My script is working fine except with N4.7
It opens the download box, but the name is download.php instead of
myfile.doc
I found the same bug with N7 on the Net. The workaround is to call the
script with "/" :
download.php/?file=xxx/myfile.doc&file_short=myfile.doc

It solves the problem with N7, but with N4.7, the only difference is with
the name. Now it is :
download_php.htm

If I specify the content type related to the file, it works fine. But I
can't do that because the file type can be anything.
It can be a word, excel or pdf file etc etc
Do you have any idea or a script to automatically set the content-type
according to the file extension ?

here is my script:
Header("Content-Type: application/octet-stream");
Header("Content-Length: ".filesize($_GET['file']));
Header("Content-Disposition: attachment; filename=".$_GET['file_short']);
readfile($_GET['file']);

Download
I need a simple php file that download all files and folders
located in the web directory, it means that with a single file in the
website, with just a click it download all files and folders.
How Can I do that?

Php 6 Where To Download It ?
I just bought the "PHP & MYSQL for dummies" book and it asks me to download php6 from www.php.net ... but when I go to downloads as described there is no php6 for download !!! The most recent version is php5.2 ...

Is php6 taken off the community again ? If not, can someone tell me where I can download it ?

Download
I'm having trouble! What i ultimately want is for each user on my site to be capped with a (maximum) 2Kb per second download transfer rate and only be able to download one file at a time.

Therefore i need to know when a user has a download in progress. So, if they try and download 2 or more files at the same time i can block them.

I don't have much idea of how to achieve this with PHP and Apache!

Can anyone point me in the right direction.

PDF Download
I'm trying to let users download various pdf documents from my site. Everything wokrs ok but when I open the pdf's that have been downloaded they are corrupted & won't open. I'm wondering if the information in the headers is incorrect, here's my code:

Php Download
I have a link to text file which is on my server. When the user clicks on the link the textfile simply displays in a new window. What i want to happen is that the file is able to be downloaded to the users machine.

I can upload with php so can i download? How do i set this up?

How Do You Force A Download?
Hello, how do I force a file to be downloaded instead of displaying it? I have PHP and HTML files that I don't want to be displayed but downloaded. How would I do this?

Download Protection
I have certain files that are to be downloaded.
Now the current system has a few usernames and passwords to access the area where these files can be downloaded from.

- I want to limit the access to this area ( better it from the existing one )
- Should i convert it to a database based user access system.
- There is a requirement that the username and the password should expire after a certain period (say 7 days ).

How can the user name passwords expiry be achieved.

Header + Download
I'm trying to figure out how to get a pdf file to download that isn't in the same directory as the download script.

The script works when I put it in the same directory

example:
http://www.mywebsite/getpdf.php?file=mypdf.pdf

but this doesn't work
http://www.mywebsite/getpdf.php?file=otherdir/mypdf.pdf

<?php
header("Content-type: application/pdf");
header("Content-Disposition: attachment; filename=$file");
readfile("$file")
?>

.txt File Download - How?
I'd like to get a prompt for a .txt file download instead of displaying it in the browser. The way things are setup now is that when a link in the nav menu is click it's pointed to download.php:

Download Counter Help
I have written a php scipt to take a download path given a keyword from an MySQL database, incriment the counter by one, and then set the header to be the download URL. Everything is working well except that the counter is incrimenting by 2 each time. This problem wont happen if the header("Location....") is comented out, and it will behave like a good counter, but, ofcorse, not start the download. I have tried setting the location to be a call to another script, which istelf contains the:

if ($download_path) {
header("Location: $download_path");
exit;
}

but the problem still persists if it starts the download...

Anyone have a clue what the problem could be?

Download Stats
I have a file on my site, results.doc, anyone can link to it and download the file. Is there a way i can keep track of how many times its been downloaded? If someone can point me in the right direction and tell me what i should search for that'll be great.

Download Once Using Unique ID
I've been asked by a friend to see if I can find a solution for controlling downloads of a song from their site. They're looking to allow people who have purchased a copy of their CD to download an additional track using a unique code thats printed on the CD cover. They want to limit the number of downloads to one per ID to prevent people from just sending the URL around. I usually hunt around the net for things like this and hope to find an open source solution, but I've had no luck on this occasion so was wondering if someone could either point me in the right direction or give me some tips in setting this up on my own. I'm working on apache with all the benefits offered by cpanel.

PHP Download Problems
Well I've been talking to friends and googling all day for an answer to my problems, but noone seems to know what's up with this, and I can't find any answers on the web.

I'm trying to make a simple download.php file, which I can call from anywhere on my website, which then downloads the file specified in the id. For eg: download.php?fileid=12345. They are everywhere, so I'm sure you know what I mean.

I'm doing the method suggested in the php.net docs, and everywhere else; send headers, then use readfile. Except the browsers seem to be allergic to it.

The one that shows the problem best, is Firefox - on a 400Kb ZIP it hung on "starting" in the transfer dialog, then after about 3-5 seconds would jump to 100% and say it was complete. I later tried it on a 4Mb RAR file, and when I requested the download, it sat loading the page for about 10-20 seconds, then brought up the "save download" dialog. I clicked save, and it immediately jumped to 100% and complete. IE and Opera are both doing the same (Opera also says "Error" instead of "Finished" when it is done). I must point out that the content of the downloaded archives is absolutely fine.

In the full blown version of the script (which didn't work), I get the ID, then check the DB for it. Get the filename from the DB, and setup the transfer. For the stripped out version, I commented out all the DB stuff, so I was left with just the transfer.

I can't see anything wrong in the code, and my friend assues me the headers are fine (although the rar mime type isn't correct).

The code:

//Clean the inputs, before using them in any further code.
$cln_fid = cleantxtinput($_GET['fid']);

//Check the database for an artwork with a matching id, and a download filename that is NOT empty.
$get_file = runquery("SELECT download FROM fti_art_artwork WHERE artid = '$cln_fid' AND download!= ''");

if (mysql_num_rows($get_file) == 1) {
while($row = mysql_fetch_array($get_file, MYSQL_ASSOC)) {
$file_name = $row['download'];
}

//Get the file extension.
$ext = explode('.',$file_name);
$ext = $ext[count($ext)-1];

//Specify the mime type, depending on the file extension.
if(preg_match('/rar/i', $ext)) {
$mime = 'application/octet-stream'
} elseif(preg_match('/zip/i', $ext)) {
$mime = 'application/x-zip'
}

header('Content-Type: '.$mime);
header('Content-Disposition: attachment; filename="'.$file_name.'"');
header('Content-Length: '.filesize('files/'.$file_name));
readfile('files/'.$file_name);

} else {
//Log the error.
$level = 4;
$error = "The user '$usersess_name' requested to download the file with id '$cln_fid', except the file didn't exist, or more than one file was found.";
logdata($level,$error,&#391;');

//Display the error.
$tpl_errcode = $errcode;
$tpl_errtxt = 'The file you requested couldn't be found. If you got to this page by following a link on our website, please contact our support desk.'
$tpl_redirect = conf_baseurl.'index'.url_sess;
include('templates/default/error.tpl.php');
exit;
}

I have no idea what is wrong. If it makes a difference, it is currently operating off a Windows PHP installation for offline use only. When it goes live, it will go on to a Linux server.

My only thought, is the file is being downloaded prior to the download dialog. Any other methods of doing the same thing?

Download Monitor
I would like to create a script that can monitor what files are being downloaded from my server. Including information like, what time the download started, ended, name of file and even speed.

I am a complete Newbie to PHP and am currently running PHP-Nuke on Windows XP, with MySql and Apache.

Has anyone here come across such a script or is it possible to create such a script?

Forcing The Download Box
I have a page that generates a text file (but writes the file with
the ".csv" extension) and then I redirect the user so he can save the
file

header("Location: $my_csv_file");

However, the file appears as text in the browser and I would prefer
that the gray "Download this file" box pop up. How could I pull this
off, or is this really more dependent on client browser settings?

Download Pdfs
I'm building a site at the moment (100+ pages) which has a huge amount of PDF files. I am creating the pages using SSI which helps me maintain the pages. On all of my pages, there is a small page pulled in at the bottom, which has a link to that specifc page in PDF. Seeing as every page is 'included', I'm declaring a varibale at the top of each page like so, and then inserting that into the link below -

<? $file = "foo"?>

<a href="/pdf/<? echo $file ?>.pdf">Download PDF!</a>

This works great, although upon clicking the link I would like the user to be taken to a new page - say download.php, where instructions on downloading Acrobat viewer are, AND a link to download the file that they have just clicked on. It seems as though the variable isn't 'carried over' to the next page unfortunately. I'm not using a database, which makes it quite tricky.

Forcing Download
i want users to be able to download files from my site via a download page and id variable
eg.. download.php?file_id=24 BUT i want this to be the only way for my users to access the files, ie they shouldn't be able to type in:

http://www.mysite.com/download/myfile.zip

so ill be storing the files below the viewable area on my site. so to access the files i need a way of making the file download, i tried to look up some cleevr things to do with headers but these seem only to work if youve made a file on the server side, any ideas how i can do this ?

Download Counter?
I'm trying to create a download counter for individual files on a web
site and I'm not sure how to do this. Right now I'm using Webalizer
to just read the log files and see how many times the files I'm
interested in were downloaded. The problem is Webalizer breaks it up
by month and I want a running total. I'd also like to see the counts
without having to log in to Webalizer in the first place. Not that
logging in or adding the results is too difficult, but it would be
nice if I could just put a little number on the web site so when I go
to the site I can imediately see the download counts.

The first thing I thought of was accessing the log files via PHP and
reading the data out of there. However because the log files get
broken up, zipped, and a new one started after they reach a certain
size I'm afraid this will be too complicated and may put too much
extra strain on the server if this is done too often.

Also, what's the best way to read log files with PHP anyway?

Download Track
I have a website support some big files(200-800M) download. I want to control download. I use Php +mysql to control it to prevent other people to link and download. Because my webhost control ftp is difficult. so I use http download.
But I do not know to use php script to detect one user have finish download,I want one user download one file at one time.

Download A File Using Php
An affiliate company i work with has a feed they publish, and I'd like to download and save it as a txt file on my server.

How can I do this using php? I'm assuming I need write a small script that will get the file on their server, save it on my server (and change the extension to txt). Then I'm going to run this script via a cronjob.

Can anyone point me in the right direction to get started on this? I'm not sure which php command I need to use to grab the feed from the other server.

Download Protector
This is a sript to protect your downloads. The $ADMIN[defaulturl] is the page the guy is going to if he did not come for the $okaysites I call the php script to download the page with this line: site=2 calls the [url_2] from the .php file.Quote:

<a target="accueil" href="http://www.rifssso.ca/rpfo/download.php?site=2&file=registre.html">Registre

How do I modify this script so I can put the target in another frame (the php script uses http referrer so the referre of the target frame is not the frame the link has been clicked. Quote: Code:

How Can I Download A Website
I am not sure if this qustion is just for php expert:
How can I download a website including all html, javascript, gifs, etc.

Download Times
I need to count how many times a specific file has been downloaded. I dont know if this will happen on the client or server side.

PHP Download Script
Hello, I designed a php download script that is somthing like this: File dl.php: PHP Code:

Download Problem
i have a problem with forcing downloads with a code like the following or some similar:

$filename = $fileName;
$size = filesize("$filename");
header ("Content-Type: application/octet-stream");
header ("Content-Length: $size");
header ("Content-Disposition: attachment; filename=$filename");
header ("Content-Transfer-Encoding: binary");
readfile($filename);

i think, normaly the code is ok, but whenever i use something like this on my system (win2k/apache and freeBSD/apache) it works only with rightcklick. using normal leftclick, the downloadbox shows (and even downloads) me only the name of the source page (filemanager.htm) or rather the html-output of the base-script.

Download Script
I have a download script that is launched after a user click on the file he want to download. the link is like <a href="download.php?id=$file&path=$path>file_name</a>

and here my download.php PHP Code:

Download Instead Of Loading
I currently keep all my intended downloadable files in a folder. I just hyperlink and list them all out. For all the other file formats when i just click on the links i will be prompt to save them. But .php extension files just tries to load up....why?

Redirect After A Download
I have a script that downloads a file using the http header method. After I download, it just sits there and waits. How can I redirect it or display something on the browser? If I use a location header, I am immediately taken to the location, and the download does not occur. If I write any commands after the download headers, the output is appended to my downloaded file which is definitely undesirable.

Download With A Timeout
I am trying to download a few files one after another from a remote
server. Problem is that I don't know how to, or if I am able at all,
set a time out for download. I don't want to time out whole script,
just a part if file won't download in 2mins then skip to the next one.
Previously, I had a Javascript implementation with AJAX, this time I
thought of doing it in PHP since PHP has far better array functions, I
don't have to do most from scratch. Yet, I with PHP implementation I
came to a problem where I am unable to cancel the download if it runs
more than so many minutes. Yet, as I said, I don't want to quit the
script completely, all I need is to skip to the next file and try that.


Copyright © 2005-08 www.BigResource.com, All rights reserved