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

Response.binaryWrite chunks of data

Hi,

I made a posting a while ago regarding doing a binarywrite of a large
file in chunks and got a lot of helpful responses. I was able to make
it work then. Unfortunately when the project is being tested its not
working and I am getting some weird results when testing. A month ago I
was able to stream a file of size 80Mb and it worked like a dream

Yesterday it would not work on the same file, but would stream smaller
files. The largest file i was able to stream yesterday was 55.5MB.
Today it wouldnot work with the 55.5MB file but only with a file of max
size of around 54.5MB. I can't seem to figure out what is causing this.
Because the code is the same. I actually get no error, with the file
size i mentioned i get a popup window within seconds for the file
download. But anything greater than that file size (max size as of
today 54.5) even if it is an MB more i get a blank screen but it never
pop ups the file download box

I am attaching my code below for reference, here is the main part of
what I am doing

Set BinaryStream = CreateObject("ADODB.Stream")
set fs = Server.CreateObject("Scripting.FileSystemObject")
Set Fil = fs.GetFile(path & filename)
BinaryStream.Type = 1
BinaryStream.Open
BinaryStream.LoadFromFile Fil.path
Dim i

Const BlockSize = 1000
For i = 1 To BinaryStream.Size Step BlockSize
Response.BinaryWrite BinaryStream.Read(BlockSize)
Next
'f Not BinaryStream.EOS Then Response.BinaryWrite
BinaryStream.Read

Any help on this crazy stuff would be appreciated :)
Thanks :)

Oct 19 '06 #1
5 8798
I don't have sample code, but if the remainder of the file size is not equal to your block size it may not finish downloading. Test
for remainder size then reset block size to capture that last amount.

you will need to google for sample code it's been done many times.


"Katie" <Dn*********@gmail.comwrote in message news:11**********************@h48g2000cwc.googlegr oups.com...
Hi,

I made a posting a while ago regarding doing a binarywrite of a large
file in chunks and got a lot of helpful responses. I was able to make
it work then. Unfortunately when the project is being tested its not
working and I am getting some weird results when testing. A month ago I
was able to stream a file of size 80Mb and it worked like a dream

Yesterday it would not work on the same file, but would stream smaller
files. The largest file i was able to stream yesterday was 55.5MB.
Today it wouldnot work with the 55.5MB file but only with a file of max
size of around 54.5MB. I can't seem to figure out what is causing this.
Because the code is the same. I actually get no error, with the file
size i mentioned i get a popup window within seconds for the file
download. But anything greater than that file size (max size as of
today 54.5) even if it is an MB more i get a blank screen but it never
pop ups the file download box

I am attaching my code below for reference, here is the main part of
what I am doing

Set BinaryStream = CreateObject("ADODB.Stream")
set fs = Server.CreateObject("Scripting.FileSystemObject")
Set Fil = fs.GetFile(path & filename)
BinaryStream.Type = 1
BinaryStream.Open
BinaryStream.LoadFromFile Fil.path
Dim i

Const BlockSize = 1000
For i = 1 To BinaryStream.Size Step BlockSize
Response.BinaryWrite BinaryStream.Read(BlockSize)
Next
'f Not BinaryStream.EOS Then Response.BinaryWrite
BinaryStream.Read

Any help on this crazy stuff would be appreciated :)
Thanks :)

Oct 19 '06 #2
Hi,

I use
if Not BinaryStream.EOS Then Response.BinaryWrite
outside the loop to get the remainder. But still no luck with larger
files

:)

Jon Paal wrote:
I don't have sample code, but if the remainder of the file size is not equal to your block size it may not finish downloading. Test
for remainder size then reset block size to capture that last amount.

you will need to google for sample code it's been done many times.


"Katie" <Dn*********@gmail.comwrote in message news:11**********************@h48g2000cwc.googlegr oups.com...
Hi,

I made a posting a while ago regarding doing a binarywrite of a large
file in chunks and got a lot of helpful responses. I was able to make
it work then. Unfortunately when the project is being tested its not
working and I am getting some weird results when testing. A month ago I
was able to stream a file of size 80Mb and it worked like a dream

Yesterday it would not work on the same file, but would stream smaller
files. The largest file i was able to stream yesterday was 55.5MB.
Today it wouldnot work with the 55.5MB file but only with a file of max
size of around 54.5MB. I can't seem to figure out what is causing this.
Because the code is the same. I actually get no error, with the file
size i mentioned i get a popup window within seconds for the file
download. But anything greater than that file size (max size as of
today 54.5) even if it is an MB more i get a blank screen but it never
pop ups the file download box

I am attaching my code below for reference, here is the main part of
what I am doing

Set BinaryStream = CreateObject("ADODB.Stream")
set fs = Server.CreateObject("Scripting.FileSystemObject")
Set Fil = fs.GetFile(path & filename)
BinaryStream.Type = 1
BinaryStream.Open
BinaryStream.LoadFromFile Fil.path
Dim i

Const BlockSize = 1000
For i = 1 To BinaryStream.Size Step BlockSize
Response.BinaryWrite BinaryStream.Read(BlockSize)
Next
'f Not BinaryStream.EOS Then Response.BinaryWrite
BinaryStream.Read

Any help on this crazy stuff would be appreciated :)
Thanks :)
Oct 19 '06 #3
look at sample here....

http://support.jodohost.com/archive/...hp/t-3511.html

"Katie" <Dn*********@gmail.comwrote in message news:11**********************@b28g2000cwb.googlegr oups.com...
Hi,

I use
if Not BinaryStream.EOS Then Response.BinaryWrite
outside the loop to get the remainder. But still no luck with larger
files

:)

Jon Paal wrote:
>I don't have sample code, but if the remainder of the file size is not equal to your block size it may not finish downloading.
Test
for remainder size then reset block size to capture that last amount.

you will need to google for sample code it's been done many times.


"Katie" <Dn*********@gmail.comwrote in message news:11**********************@h48g2000cwc.googlegr oups.com...
Hi,

I made a posting a while ago regarding doing a binarywrite of a large
file in chunks and got a lot of helpful responses. I was able to make
it work then. Unfortunately when the project is being tested its not
working and I am getting some weird results when testing. A month ago I
was able to stream a file of size 80Mb and it worked like a dream

Yesterday it would not work on the same file, but would stream smaller
files. The largest file i was able to stream yesterday was 55.5MB.
Today it wouldnot work with the 55.5MB file but only with a file of max
size of around 54.5MB. I can't seem to figure out what is causing this.
Because the code is the same. I actually get no error, with the file
size i mentioned i get a popup window within seconds for the file
download. But anything greater than that file size (max size as of
today 54.5) even if it is an MB more i get a blank screen but it never
pop ups the file download box

I am attaching my code below for reference, here is the main part of
what I am doing

Set BinaryStream = CreateObject("ADODB.Stream")
set fs = Server.CreateObject("Scripting.FileSystemObject")
Set Fil = fs.GetFile(path & filename)
BinaryStream.Type = 1
BinaryStream.Open
BinaryStream.LoadFromFile Fil.path
Dim i

Const BlockSize = 1000
For i = 1 To BinaryStream.Size Step BlockSize
Response.BinaryWrite BinaryStream.Read(BlockSize)
Next
'f Not BinaryStream.EOS Then Response.BinaryWrite
BinaryStream.Read

Any help on this crazy stuff would be appreciated :)
Thanks :)

Oct 19 '06 #4

"Katie" <Dn*********@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
Hi,

I made a posting a while ago regarding doing a binarywrite of a large
file in chunks and got a lot of helpful responses. I was able to make
it work then. Unfortunately when the project is being tested its not
working and I am getting some weird results when testing. A month ago I
was able to stream a file of size 80Mb and it worked like a dream

Yesterday it would not work on the same file, but would stream smaller
files. The largest file i was able to stream yesterday was 55.5MB.
Today it wouldnot work with the 55.5MB file but only with a file of max
size of around 54.5MB. I can't seem to figure out what is causing this.
Because the code is the same. I actually get no error, with the file
size i mentioned i get a popup window within seconds for the file
download. But anything greater than that file size (max size as of
today 54.5) even if it is an MB more i get a blank screen but it never
pop ups the file download box

I am attaching my code below for reference, here is the main part of
what I am doing

Set BinaryStream = CreateObject("ADODB.Stream")
set fs = Server.CreateObject("Scripting.FileSystemObject")
Set Fil = fs.GetFile(path & filename)
BinaryStream.Type = 1
BinaryStream.Open
BinaryStream.LoadFromFile Fil.path
Dim i

Const BlockSize = 1000
For i = 1 To BinaryStream.Size Step BlockSize
Response.BinaryWrite BinaryStream.Read(BlockSize)
Next
'f Not BinaryStream.EOS Then Response.BinaryWrite
BinaryStream.Read

Any help on this crazy stuff would be appreciated :)
Thanks :)
I take it you have a Response.Buffer = False in there somewhere?
Also a block size of 1000 is way too small use a 1MB chunk instead.
Oct 19 '06 #5

"Katie" <Dn*********@gmail.comwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
Hi,

I made a posting a while ago regarding doing a binarywrite of a large
file in chunks and got a lot of helpful responses. I was able to make
it work then. Unfortunately when the project is being tested its not
working and I am getting some weird results when testing. A month ago I
was able to stream a file of size 80Mb and it worked like a dream

This is what you need :)

Response.ContentType = "application/x-zip-compressed" 'here your content -
type

Dim strFilePath, lSize, lBlocks
Const CHUNK = 2048
strFilePath = ["yourpath here!"]
set objStream = CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = 1
objStream.LoadFromFile strFilePath
lSize = objStream.Size
Response.AddHeader "Content-Length", lSize
lBlocks = 1
Response.Buffer = False
Do Until objStream.EOS Or Not Response.IsClientConnected
Response.BinaryWrite(objStream.Read(CHUNK))
Loop

objStream.Close

Oct 20 '06 #6

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

Similar topics

0
by: B_O_B | last post by:
I am using Response.BinaryWrite to display JPEG's to the browser. The problem is that in IE, one particular JPEG is loading very slow. Normal JPEG's take a few seconds, but this one sometimes...
5
by: katrinaVictim | last post by:
Question: I get the eror listed at the bottom of the post. What can I do to make the response of the x1.send a "binary" type? Or, in general, how can I just "make this work"? <%@...
2
by: hoenes1 | last post by:
I've got an aspx-Page "SendFile.aspx" which is called by a Link on "ShowListOfFiles.aspx" and sends the file in the OnLoad Eventhandler. The filename to download is stored in a Session variable....
1
by: Sridhar | last post by:
Hi, I am trying to display a pdf file on the web. It is working fine but the Page_Load method is running twice before displaying the page. Here is the code that I am using Private Sub...
2
by: jhansl | last post by:
Hello, I am trying desperately how to find out if the bytes sent in a Response.BinaryWrite (or bytes written to Response.OutputStream) are ACTUALLY sent to the client. My problem is that I have...
2
by: ATS | last post by:
HOWTO Override ASP's Response output for 2003/IIS. Please help, I want to have an ASP page write back EVERYTHING to the ASP Response. That includes HTTP Headers. I want my ASP to look...
5
by: twiggy182 | last post by:
Hi, I really need you help because I'm not very familliar with ASP and I could not find any solution to my problem. To put you in situation, I have a CGI to which I send a file name, and that...
0
by: =?Utf-8?B?am9obm55IHA=?= | last post by:
Hello - Ive created an HttpHandler for uploading binary files to an http compliant client (not a browser). These files I upload are fairly large around 256 MB. My code essentially chunks up the...
2
by: Ron Hinds | last post by:
I'm getting this in an ASP application on IIS6/W2K3. The page in question is trying to return a XML file approximately 45MB in size. Changing this is not an option. Worked fine on IIS5/W2K. I tried...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
1
by: Shællîpôpï 09 | last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....

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.