Problem to download Large mp3 file (over 4MB) using ADODB.Stream

Hi,
I created a code to download different files (jpg, gif, mp3, wma) from the client's website. I use ADODB.Stream object.
I don't have any problems with jpg and gif formats. When I try to download mp3/wma files I get IE msg: IE cannot open this site. I defined that the problem is in the file size.  If file is over 4MB (Response.BinaryWrite adoStream.Read(4194000) ) I can't download it.
I tested already different solutions like:
1. Change timeout, buffer, flush.
2. Chunk

Nothing!!! Plus I can't use any COM that needs to be registered on provider's server. Please review my code below.
I hope to get any solution ASAP.
Thanks.

*******************************************************************************
Private Sub DownloadFile(file)
   Dim strAbsFile, objFSO, objFile, adoStream
      
    Response.Buffer = False
    strAbsFile = Server.MapPath(file)

    Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
    If objFSO.FileExists(strAbsFile) Then
        Set objFile = objFSO.GetFile(strAbsFile)
      
        Response.ContentType = "application/x-unknown"  
        Response.AddHeader "Content-Disposition", "attachment; filename=" & objFile.Name
        Response.AddHeader "Content-Length", objFile.Size
      
        Set adoStream = CreateObject("ADODB.Stream")
      adoStream.Open()
      adoStream.Type = 1
      adoStream.LoadFromFile(strAbsFile)
      Response.BinaryWrite adoStream.Read(4194000)   ' <-- if file size is over then IE Msg: IE cannot open this site.
      adoStream.Close
      Set adoStream = Nothing
      Response.End
     end if
    Set objFile = Nothing
end sub

alexmindelAsked:
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

kevp75Commented:
I use a slightly different function to do the same, and I haven't had a problem (other than timeing out, but that was cured by setting server.scripttimeout = 3000000), using this function

Private Sub DownloadFile(file)
      Dim strAbsFile
      Dim strFileExtension
      Dim objFSO
      Dim objFile
      Dim objStream
      strAbsFile = file
      Set objFSO = Server.CreateObject("Scripting.FileSystemObject")
            If objFSO.FileExists(strAbsFile) Then
                  Set objFile = objFSO.GetFile(strAbsFile)
                        Response.Clear
                        Response.AddHeader "Content-Disposition", "attachment; filename=" & objFile.Name
                        Response.AddHeader "Content-Length", objFile.Size
                        Response.ContentType = "application/octet-stream"
                        Set objStream = Server.CreateObject("ADODB.Stream")
                              objStream.Open
                                    objStream.Type = 1
                                    Response.CharSet = "UTF-8"
                                    objStream.LoadFromFile(strAbsFile)
                                    Response.BinaryWrite(objStream.Read)
                              objStream.Close
                        Set objStream = Nothing
                  Set objFile = Nothing
            Else  'objFSO.FileExists(strAbsFile)
                  Response.Clear
                  Response.Write("No such file exists.")
            End If
      Set objFSO = Nothing
End Sub


to use it:
Call DownloadFile(pathtothefile)
0

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
kevp75Commented:
i've tested it with 25M files, and the only problem (minus the timeout error which I fixed) is that it takes a little time to download it, but it does work
0
alexmindelAuthor Commented:
Thank you for your quick responds. I used your function but I can't still open mp3 file.
When I click on the link "download", the download popup does not appear but looks like procedure is running.
In 2-3 minutes the blank page is opened. What do you think about it?
0
Cloud Class® Course: Microsoft Exchange Server

The MCTS: Microsoft Exchange Server 2010 certification validates your skills in supporting the maintenance and administration of the Exchange servers in an enterprise environment. Learn everything you need to know with this course.

kevp75Commented:
can you download another file type?, a .doc, .zip perhaps?
0
alexmindelAuthor Commented:
I tested txt, doc, jpg and gif. They worked fine. Zip file had a size over 4MB. Thus, I couldn't download it.
Probably, I'll not be able to download any files over 4MB.
0
kevp75Commented:
what happens if you don't use any script...ie..link to the file itslef?
0
kevp75Commented:
0
alexmindelAuthor Commented:
I used that last variant before and got same problem: downloaded files were corrupted.
If I use direct link to the file itself it works perfect (only popup doesn't appear). I think that is the sream object problem.
Thus, I am gonna do the following: convert mp3 files to wma format (size will be around 2MB). But It is not the real solution: problem is still there.
Thank you, kevp75, for your time and help. Let me know if you find anything else later. That would be interesting because the same problem will appear from time to time.
Best regards,
Alex.
0
kevp75Commented:
will do alex.....np
0
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
ASP

From novice to tech pro — start learning today.

Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.