473,401 Members | 2,068 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Download file size pregress bar

I currently use a php script to allow for downloads of a program i
wrote. Some people have complained that there file browsers are
unable to determine the file size (14 meg) so that they do not know
how long it will take to download ( the browser says file size
unknown) Is there a way in pohp to tellthe browser the file size so
that it can produce the progresss bar on the download?
Nov 22 '05 #1
4 1385
On 15 Nov 2005 16:24:09 -0600, wagon <wa***@hotmail.com> wrote:
I currently use a php script to allow for downloads of a program i
wrote. Some people have complained that there file browsers are
unable to determine the file size (14 meg) so that they do not know
how long it will take to download ( the browser says file size
unknown) Is there a way in pohp to tellthe browser the file size so
that it can produce the progresss bar on the download?


http://www.w3.org/Protocols/rfc2616/....html#sec14.13
--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Nov 22 '05 #2
THANKX
I assume it is the Content-Length: . What is the conversion for 14.9
megabytes?

Hate to be a pOn Tue, 15 Nov 2005 22:25:55 +0000, Andy Hassall
<an**@andyh.co.uk> wrote:
On 15 Nov 2005 16:24:09 -0600, wagon <wa***@hotmail.com> wrote:
I currently use a php script to allow for downloads of a program i
wrote. Some people have complained that there file browsers are
unable to determine the file size (14 meg) so that they do not know
how long it will take to download ( the browser says file size
unknown) Is there a way in pohp to tellthe browser the file size so
that it can produce the progresss bar on the download?


http://www.w3.org/Protocols/rfc2616/....html#sec14.13

Nov 22 '05 #3
As I've said a number of times, don't use a PHP script to serve
downloads of large files. The reasons are:

1) The web server can do it much more efficiently. Each instance of PHP
takes up quite a lot of memory. There's also quite a lot of double
copying as the data travels through different layers.

2) The web server knows how to handle partial retrieval--needed for
resuming interrupted downloads and quick navigation through large PDF
files.

3) Earlier versions of the Apache 2 SAPI module leaks memory, losing
every byte output by PHP. A rapid sequence of multi-megabyte downloads
will consume all available memory, leading to a server crash.

Getting back to your original question, you need to send the
Content-Length header.

Nov 22 '05 #4
On 15 Nov 2005 16:41:19 -0600, wagon <wa***@hotmail.com> wrote:
I assume it is the Content-Length: W
Yep.
What is the conversion for 14.9 megabytes?


Depends whether you work for a hard drive manufacturer, or live in the real
world.

1 megabyte = 1024 * 1024 bytes = 1048576 bytes.

(If you're a pedant then you can call it a "mibibyte").

If you're actually reading from a file, use filesize() to get the size in
bytes. If you send a Content-Length then you have to get it exactly right, else
Bad Things probably happen.

In case you're confused by the terminology in the standard, a "byte" and an
"octet" are, for all intents and purposes, the same thing.
--
Andy Hassall :: an**@andyh.co.uk :: http://www.andyh.co.uk
http://www.andyhsoftware.co.uk/space :: disk and FTP usage analysis tool
Nov 22 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Dave | last post by:
Hi Everyone, I was wondering if anyone has ever successfully used SA-FileUp's download feature. I am being forced to change from "ASPSmartUpload" as the server I am moving everything to is...
0
by: Sarah Akers | last post by:
GgF ----gL5cJ72EqiGIQ0SK65Rz Content-Type: text/html; Content-Transfer-Encoding: quoted-printable <html> <head> <style type=3D"text/css">.eyebrow { FONT-WEIGHT: bold; FONT-SIZE: 10px; TE=
0
by: Anne Snow | last post by:
7qs ----bSCMEc0pLIbJxmV9 Content-Type: text/html; Content-Transfer-Encoding: quoted-printable <html><head><style type=3Dtext/css>.eyebrow { FONT-WEIGHT: bold; FONT-SIZE= : 10px;...
0
by: Lynda Kilgore | last post by:
jGu ----qtHwhORV90yyhqJMOc Content-Type: text/html; Content-Transfer-Encoding: quoted-printable <html><head><style type=3Dtext/css>.eyebrow { FONT-WEIGHT: bold; FONT-SIZE= : 10px;...
0
by: kain razial | last post by:
ANYOTHER NEEDS ALSO CONTACT ME.I WILL HELP YOU TO GET THAT TEKLA XSTEEL V 12 DOWNLOAD LINK. http://www.sendspace.com/file/zem32r
0
by: kain razial | last post by:
ANYOTHER NEEDS ALSO CONTACT ME.I WILL HELP YOU TO GET THAT TEKLA XSTEEL V 12 DOWNLOAD LINK. http://www.sendspace.com/file/zem32r
7
by: lawrence k | last post by:
I've got a music studio for a client. Their whole studio is run with Macintosh computers. Macintosh computers allow file names to have open white spaces, such as "animal hospital.mp3". I have a...
6
by: empiresolutions | last post by:
Using the following code, files greater than 10Megs do not download. Less than 10 is working. Can anyone explain why? Files that will be downloaded are 5G plus in size. function download() {...
1
KevinADC
by: KevinADC | last post by:
Note: You may skip to the end of the article if all you want is the perl code. Introduction Many websites have a form or a link you can use to download a file. You click a form button or click...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.