472,353 Members | 1,475 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 472,353 software developers and data experts.

Question about readfile

1
Hello everyone,

I was woundering if PHP "readfile" method consume server bandwidth by the size of the file that is read.
I am asking this because I am creating a download script for large file like this
[PHP]
...
header("Pragma: public");
header("Expires: 0");
header("Cache-Control: must-revalidate, post-check=0, pre-check=0");
header("Cache-Control: private",false);
header("Content-Type: $type");
header("Content-Disposition: attachment; filename=\"".basename($filename)."\";" );
header("Content-Transfer-Encoding: binary");
header("Content-Length: ".filesize($filename));
readfile("$filename");
....
[/PHP]
with the above code it seem that whenever some one choose to download file with that script, the bandwidth get consumed by the file size automaticly even if I tryied to cancel it after few kilobytes, it consume the whole file size

am I wrong or not?
and if there is other better way to do it please let me know

what I need is to let the user download AVI files, this code
[PHP]
header('Location: ' . $row['url']);
[/PHP]
works fine with Firefox, it show the save dialog and doesnt consume bandwidth
but when trying it with IE, it automatically save it to the Temporary folder without showing the save dialog (open/save location dialog), and I dont want it to do this

any help will be appreciated

Thanks in advance,
Apr 7 '07 #1
0 1281

Sign in to post your reply or Sign up for a free account.

Similar topics

16
by: dario | last post by:
Hi, Im new on phyton programming. On my GPRS modem with embedded Phyton 1.5.2+ version, I have to receive a string from serial port and after send...
2
by: Schorschi | last post by:
Can't seemd to get ReadFile API to work! Returns invalid handle error? ===========================================================================...
1
by: Jørn Dahl-Stamnes | last post by:
I'm trying to replace <IMG SRC="some image"> with the usage of readfile, but without luck. I have seen examples like this: header...
8
by: Andrew Robert | last post by:
Hi Everyone. I tried the following to get input into optionparser from either a file or command line. The code below detects the passed...
3
by: Paul F. Johnson | last post by:
Hi, I'm trying to create a zip file from some pdfs and have code similar to this $id=$_GET; $fn = array("a", "b", "c", "d");...
3
by: scorro1 | last post by:
Hey guys, I am working on a program which is supposed to read input from a file at 100 chars per time, then change the spaces to underscores and...
4
by: Eric Renken | last post by:
I am trying to do an Overlapped ReadFile on a HID device and it just isn't working for me. The WaitForSingleObject keeps giving me an error "The...
1
by: mkarja | last post by:
Hi, I have a windows MDI program that draws some shapes that can be saved into a file and read from that file. The save seems to work with the...
15
by: Ketchup | last post by:
Hello everyone, I have been stuck with this problem for quite some time now. I am working in VB.NET, using framework 1.0. I have to keep the...
0
jalbright99669
by: jalbright99669 | last post by:
Am having a bit of a time with URL Rewrite. I need to incorporate http to https redirect with a reverse proxy. I have the URL Rewrite rules made...
0
by: AndyPSV | last post by:
HOW CAN I CREATE AN AI with an .executable file that would suck all files in the folder and on my computerHOW CAN I CREATE AN AI with an .executable...
0
by: Arjunsri | last post by:
I have a Redshift database that I need to use as an import data source. I have configured the DSN connection using the server, port, database, and...
0
hi
by: WisdomUfot | last post by:
It's an interesting question you've got about how Gmail hides the HTTP referrer when a link in an email is clicked. While I don't have the specific...
0
by: Matthew3360 | last post by:
Hi, I have been trying to connect to a local host using php curl. But I am finding it hard to do this. I am doing the curl get request from my web...
0
Oralloy
by: Oralloy | last post by:
Hello Folks, I am trying to hook up a CPU which I designed using SystemC to I/O pins on an FPGA. My problem (spelled failure) is with the...
0
by: Carina712 | last post by:
Setting background colors for Excel documents can help to improve the visual appeal of the document and make it easier to read and understand....
0
BLUEPANDA
by: BLUEPANDA | last post by:
At BluePanda Dev, we're passionate about building high-quality software and sharing our knowledge with the community. That's why we've created a SaaS...
0
by: Rahul1995seven | last post by:
Introduction: In the realm of programming languages, Python has emerged as a powerhouse. With its simplicity, versatility, and robustness, Python...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.