Download Files Quickly = Hang
This isn't exactly a PHP-related question, but I'm hoping that the
community of developers here will have experience dealing with it. We
want to allow users to view large files on our site, but we've realized
that if users in IE click from one file to another too quickly (before
the previous files have fully loaded), future files do not load until
they close and reopen their browsers. We believe this is because of
the two-concurrent-downloads limit -- apparently Firefox correctly
recognizes when a download has been abandoned on the user's end, while
IE does not, and this causes problems.
View Complete Forum Thread with Replies
See Related Forum Messages: Follow the Links Below to View Complete Thread
I Can't See Any Dll Files In Php Download?
I downloaded the windows binary php4.0.4 from php.net and it says to move a certain dll file to your windows directory. I looked in the dll folder and it is empty. So, I tried downloading a php/apache package at a site just for windows users, and when I unzipped that package, I saw the dll files scrolling by in the unpacker window, but once again the dll folder was empty. Where are they?
How Do I Hide Files From Download Without Php?
I want to hide files or better say restrict access to them for usual download. I want to send them just to allowed users with php? How do I do that? I've tried to put variuos permisions on the directory, and then run this code: <? header("Content-type: application/octet-stream"); header("Content-Disposition: attachment; filename=file.rar"); $ff = fopen("restricted/anyName.zip", 'r'); fpassthru($ff); ?> If there are any restrictions, user downloads only 400b file, if there's no restrictions user gets normal filesize.
Zip Files, Then Force Download
Is there any examples or scripts that already will do this? I need to zip an arbitrary amount of files, say maybe a $files array full of path names to the files filled dynamically from database based on an id number... then i need it to automatically force a download of the zip file to the browser, then automatically delete the zip file when its finished...
Select Files To Download
i have made a page with several photos of a party. There is a index in the page, and under each thumbnail there is a checkbox. With them people can select the photos that he's going to download, but i don't know how i can send the selected photos. I think "compress" all the selected photos in a file and send it, but i couldn't do it. I used zlib and bz2 libraries, but i dont know how i can put more than one file, and even with an only file the compress file dont work. What i make is open the file, read it and then compress the string get of the read in the new compress file, but this file is empty or have a code of the zlib.
Corrupted ZIP Files During Download Via PHP
I am posting this rather lengthy description here in hope of getting at least some insight into a problem that is really hurting my business, since I have come to the conclusion that my problem is at least partly PHP-related. Some time now I have been having transfer problems, i.e. my customers downloads of large binary (ZIP) files are often corrupt. A corrupted file now and then can of course never be avoided, but I get several complaints from customers every day. Of any specific file, approx. 1 out of 4 downloads (larger than 100kB or so) are affected. I have spent months trying to find the source of the problems without success, but I have been able to rule out many possible causes. Here are some facts: 1) The actual files are OK on the server. Direct (unencrypted) links are fine, so it's not a general problem. 2) About 50% of the customers download (the exact same files) from another source. I don't even get 1 complaint every two months from those customers, while I get 1-3 complaints _every day_ from those who download from my server. 3) The customers have various SW/HW/OS, so it's very unlikely that it's a user problem. Plus, the same customer often download from both places, but only have problems with the files from my server. 4) I have shut down all scripts for a while, so that only a static website remained, but it didn't help. 5) I have had this problem on three servers: The present RaQ550, the previous RaQ4 and the RaQ4 I had before that. So it's highly unlikely that it is server-related. 6) I can easily reproduce the problem myself. As I looked into this I found a systematic error: Analyzing corrupt vs. clean ZIP file downloads with a binary/hex editor clearly shows that the error is systematic. Clean ZIP files have a lot of ༼h' bytes in them. In ALL of the corrupt ZIP files ALL (well, most) of these bytes have been exchanged for ƋC30h', i.e. TWO bytes ( 00h -> 5C30h ) ! Since ƋC30h' equals an escaped zero, i.e. "", my guess is that there is a translation error somewhere. So, what does PHP have to do with this? Well, my download links to purchaseware are encrypted by the PHP "ewportal": From the few facts I have been able to uncover it seems there is sometimes a problem with corrupted ZIP files depending on the setting/compilation of ZLIB. If anyone on this forum have experienced similar things I would very much appreciate if they could share. My servers PHP configuration is at:
Protect Download Files
I´m developping an application that needs to show some videos, but in a protected envinroment. Any user must be authenticated to see the videos. But for example, if anyone know the path of the videos, can access directly to this site and download it without authentication. If I write in the location bar the url of a video, I can download without problem because the application cannot test if the user is already authenticated or not. I´ve read something about RedirectMatch and it works well but now the users cannot see the videos. I try to write an example: ..- #I write this rule in the httpd.conf RedirectMatch (.*).avi$ /myapplication/tools/downloadfile.php?filename=$1 With this rule I redirect all the requests for the video files include the request of a window media player, but I don´t want to do this. When I show the video directly on the web, I don´t need to redirect but when is a direct request from url to download the file, I must check if the user is authenticated.
Browser Tries To Download .php Files Instead Of Executing Them
I'm running Redhat 9 and just upgraded from PHP 4.2.x to 4.3.1 and no when I try to execute a script on my local server here it opens a window to try and download any .php files. I think Apache isn't loading the module, but when I add in: LoadModule php4_module modules/libphp4.so it can't find the module and I can't find it on my system under libexec or modules or anywhere else for that matter. What do I need to do to httpd.conf (or php.ini) to make it execute these scripts?
User Download Files From Database
I make a code to Download file userfiles from database these are userfiles, admin upload files and user download it from the database,but there is little problem i can't fix it Code:
Finding Nth Root Of X Quickly?
what is a quick way of finding the nth root of a large number? My program checks a bunch of numbers to find their square root, cube root, 4th root etc. but I think I could make it faster. I've tried using pow($number,(1/2)); but the numbers I'm using are way to big (hundreds of digits) so I tried the same thing with bcpow() but it would only return 1 when I tried to use (1/2) as the exponent. Why is that?
Pages Expiring Too Quickly
I have several forms that are running into each other, passing variables and pretty tables. I use SID to control sessions, but here is what my problem is. (it is very easy, but I don't know how to go about it) My pages expire as soon as user leave them. If they want to go back in order to view it again or select different link, they have to click on "Refresh" button. They all complain, how can I stop this? I did not have that problem initially it only started recently.
A Follow-up To My Download-all-files-as-a-zip-file Post
I made a script that successfully creates a .zip file of all the files in a directory on my web server, but now what I haven't figured out how to do is how to have it automatically deleted when the user successfully downloads it, as otherwise my server would eventually get clogged up with all these zip files.
Download Link For Exe Files Dont Work!
i'm developing a php app that shows folders and subfolders with their content so someone can download files from those browsers. the problem is: the download does not work for exe files! http://www.scotland.ca/dmspro/_uplo...4Std_Manual.PDF works and http://www.scotland.ca/dmspro/_uplo...-%20netants.zip works too! but http://www.scotland.ca/dmspro/_uplo...ils/wrar320.exe and http://www.scotland.ca/dmspro/_uplo...ISO_v6_5_en.exe do not work!!! where could be the problem there??
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?
Allowing Users To Download Files Using Headers
I am trying to create an area where a user can come to a page that queries a database and displays links to files. Here is the code for the link: <td><a href="download.php?path=../ftp/$path&name=$name" target="_blank">$name</a></font></b></td> Quote:
Easy Framework To Quickly Develop Php App
I only know basic of html/FTP knowledge but experienced in xBase programming. I am looking for nice/easy framework/tools to quickly develop a php database app (eg: table setup, master/details entries) with good looking interface and data field validation. Can you recommend any and comment/compare their features ?
Download Files From Remote Server To Local Webserver
I am trying to create a php page whereby people can download files from a remote server to their own server (to update their webdirectory with updated files/images etc). So for example one php page (e.g. update.php) should be able to download files from a remote server to a specific directory on their local webserver. Is this possible?
Curl - Resume Http Download - Apache Log Files. Gz
I am writing a Php script to run on my home PC (Windows) that downloads an Apache access log file and inserts new entries into a database.. The only way I can access these log files is through a cPanel URL that delivers a gzipped copy of the log file with all entires for the current month (up to the current date and time). I want to run this script once a day (at night) and would like to download the gzipped file by resuming from where I left off the day before (instead of always downloading the entire gzipped file). I have tried using CURL with the option - curl_setopt($ch, CURLOPT_RESUME_FROM, $prev_offset) - but that always restarts the download from the beginning. ($prev_offset is the previous days file size). I'm not sure what the structure of a gzip file is, so I don't even know if it is possible to resume a gzip file download when the file has been rebuilt in the mean time (cPanel creates a gzipped file with the same name from the raw log files every time you access that page in cPanel). My guess is that this is probably not possible. ... But .... I am trying to make the resume work to find out for myself and I can not make the resume work. The bottom line is that I am trying to avoid downloading the entire gzipped log file every time I need to download it. As an alternate, I have been successful using gzopen, and then I can gzseek to the previous offset, but I am unable to use a secure URL (https) with the Zlib functions (gzopen) with my Windows version of Php (the username and password have to be included in the cPanel URL to access the log file, so I'd like to use SSL.) (I have started another thread to figure out how to get a Php Windows binary with https and ftps as registered streams (built with --with-openssl in the ./configure command), but so far I have gotten no replies). Question: When using gzread, where does the decompression take place - on the server where the file is located, or on my PC after the compressed data is downloaded? Does gzseek work on a compressed file, or must it be uncompressed on the server first? The point being; when I use gzopen and gzread, am I downloading compressed or uncompressed data from the server where the log files are located? I can use either method, but want to meet two requirements. 1. I do not want to download redundant (old) data every day (I want to resume where I left off) ... and ... 2. I want to send the request for the log file (containing a username and password) using SSL.
Insert Multiple Variables Into A Database Quickly
I've just started using PHP and have written a small script to insert 10 variables into my database, e.g: $query = "insert into items values ('".$q1."', '".$q2."', '".$q3."', '".$q4."', '".$q5."','".$q6."', '".$q7."', '".$q8."', '".$q9."', '".$q10."')"; The problem is, I will eventually need 300 questions so I don't want to list them all individually. How can change this snippet of code so that it says something along the lines of "please insert all the variables q1-q300 into the database"?
Automatic Download Of Files Using Application/save On Windows XP SP2 Browsers
For the past two years, we have offered files for download through a secure website. Users, after clicking on a link, are redirected to a PHP page that passes the appropriate header information to the user and inquires if that user wishes to download the file. A sample of that code is below: header('Content-Type: application/save'); header('Content-Disposition:attachment; filename="'.$file_path .'"'); header('Content-Transfer-Encoding: binary'); header('Content-length: ' . filesize($full_file_path)); readfile($full_file_path); However, with the enhanced security now available in Windows XP SP2, users are no longer prompted to download the file. In fact, Windows XP SP2 not only suppresses the download but will not even present the end user with an option to download the file. Has anyone else encountered this type of situation? If so, is there a programmtic solution to, at the very least, prompt the user to download the file without requiring the user include the website as one of his/her trusted websites.
Quickly Adding Text To A Mysql Text Field That Is NOT Empty
Is there a way to insert text into a mysql text field that already has text into it; without having first to extract the existing data and append the new text to that string variable and then insert the new string. Basically i'm looking for a way to do it with a single query not 2 (one being a select to gather existing data).
Including Files In Different Direcories That Include Files From Teirs
Okay, I made a simple AJAX shoutbox and I want to include it on all my pages. To insert the shoutbox I simply type <? include('/shoutbox/shoutbox.php');?> into my HTML page. The problem is, that in /shoutbox/shoutbox.php I also include settings.php, functions.php, and some other files, and when I include /shoutbox/shoutbox.php into my index page, /shoutbox/shoutbox.php tries to call settings.php from the same folder that my index file is in, since I just 'included' it in index's source. So my question is, is there any way, without using frames, to include a PHP file as it would be if you link directly to it in the address bar, but placed into another file in a different directory?
How Do I Hide Database Connection Files Using PHP Include Files?
I have the following at the beginning of the PHP page: <?php require_once('Connections/conn.php'); ?> I want to hide the connection file, "conn.php", so it's out of the web accessible file structure. I understand putting them in the php include directory shoudl do this. For example, let's say the directory I put them in is /www/phpIN/, and /www/ht/ is the root web directory. So I put "conn.php" in the inlcude directory (/www/phpIN/conn.php) and removed it form CONNECTIONS directory.
How Do I Hide Database Connection Files Using PHP Include Files?
I have the following at the beginning of the PHP page: <?php require_once('Connections/conn.php'); ?> I want to hide the connection file, "conn.php", so it's out of the web accessible file structure. I understand putting them in the php include directory shoudl do this. For example, let's say the directory I put them in is /www/phpIN/, and /www/ht/ is the root web directory. So I put "conn.php" in the inlcude directory (/www/phpIN/conn.php) and removed it form CONNECTIONS directory. Now it doesn't work. What do I need to change?
Creating Dir, Copy Files And Pass Variables To 2 Files
I need to create a folder on the server weekly named by the user. To this folder copy the contents of an /Original folder. Inside the new folder edit one of the files to insert a data with a XML path generated in another application, copied (via memory) and pasted within the very first form and passed to the file in question. <param name="FlashVars" value="xmlfile= $lanofile" /> the $lanofile is the value that I need to pass from the form to be read by this file. I have created an form (n.php) that POST the name of the folder to a second file (creatdir.php) everything is cool until I have to edit the third file. How can I pass the value of one of the formfileds to a second file and them read this value as a variable to be consumed as mentioned above? Or actually right whatever is on the third field to this position (not using variables).
Upload Audio Files Of Type .wav & Video Files Of Type .avi
I need to upload audio files of type .wav & video files of type .avi / .mov but my current file unloader is not helping me with that. My unloader works with application types, images, txt, pdf , mp3, mpg, mpeg but not with those .wav & .mov/.avi files........
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,Ƈ'); //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?
|