473,396 Members | 1,997 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,396 software developers and data experts.

Sending a file's contents to a user, 7MB only?

I am trying to send a file's contents to the browser, the file is
80MB, but I can only download 6.99, then the file ends. I used
set_time_limit(0), but it still happens... Any help? Thanks in advance.
Feb 3 '08 #1
2 1079
Hi,

Try using fread with this function:

function sendFile($path)
{
$ok = true;
$file = fopen($path, 'rb');
if (!$file) {
$ok = false;
} else {
while (!feof($file)) {
if (($buf = fread($file, 131072)) === false) {
$ok = false;
break;
}
echo $buf;
flush();
}
if (!fclose($file)) {
$ok = false;
}
}
return $ok;
}

On Feb 3, 1:48 pm, Bruno Rafael Moreira de Barros
<brunormbar...@gmail.comwrote:
I am trying to send a file's contents to the browser, the file is
80MB, but I can only download 6.99, then the file ends. I used
set_time_limit(0), but it still happens... Any help? Thanks in advance.
Feb 3 '08 #2
On Feb 3, 8:52*pm, petersprc <peters...@gmail.comwrote:
Hi,

Try using fread with this function:

function sendFile($path)
{
* $ok = true;
* $file = fopen($path, 'rb');
* if (!$file) {
* * $ok = false;
* } else {
* * while (!feof($file)) {
* * * if (($buf = fread($file, 131072)) === false) {
* * * * $ok = false;
* * * * break;
* * * }
* * * echo $buf;
* * * flush();
* * }
* * if (!fclose($file)) {
* * * $ok = false;
* * }
* }
* return $ok;

}

On Feb 3, 1:48 pm, Bruno Rafael Moreira de Barros

<brunormbar...@gmail.comwrote:
I am trying to send a file's contents to the browser, the file is
80MB, but I can only download 6.99, then the file ends. I used
set_time_limit(0), but it still happens... Any help? Thanks in advance.-Hide quoted text -

- Show quoted text -
I dont think I understand this function completely, but what I do is
basically the same...

I open a file, get 4KB and send the 4KB, then repeat. What I dont do
is while !feof, I just do while fread 4KB...
Could that be the problem?
Feb 4 '08 #3

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

Similar topics

2
by: Gabriel Gudenus | last post by:
Hi Group! I am just working on a client-server network application which exchanges different Message Classes. (ObjectInputStream and ObjectOutputStream) Now i also would like to send a file...
1
by: chuck amadi | last post by:
By the way list is there a better way than using the readlines() to > > >parse the mail data into a file , because Im using > > >email.message_from_file it returns > > >all the data i.e reads one...
3
by: John Chen | last post by:
I need to use iframe to create a floating frame. But the contents in the iframe is not a external html file. Rather, it will be dynamically created by jsp. How can I set the src attribute to a URL...
5
by: BaWork | last post by:
I have a web form where a client can select which site members to send an email to. This form is populated from the contents of the member table, so the form can have 0-x names listed on it...
1
by: Michael McGarrigle | last post by:
I would like to send the contents of a file using xp_sendmail however I do not want the file contents to be an attachment. I have no problem sending the file as an attachement. Can anybody give me...
9
by: Sandy | last post by:
can mfc application, send text data to opened notepad file in desktop?(live transfer of data) . can anybody help
5
by: Vishal | last post by:
Hello, I already asked this question in the ASP.NET forums, but no help came. So I am hoping that somebody can help me out. This is really very URGENT me. For my e-commerce application, I...
7
by: bleachie | last post by:
Hey, I just need some help, my form seems to not send me all of the 'guestNames' and 'guestEmails' forms. i use this function to add more guestnames and guestemail fields based on the number of...
3
by: raj200809 | last post by:
when i m sending mail i received error from symantec Antivirus" Your email message was unable to be sent because your mail server rejected the message 550-5.7.1 the ip you’re using to send mail is...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
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?
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
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
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...

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.