ADODB.Stream LoadFromFile -> File could not be opened.

I'm using the ADODB.Stream LoadFromFile method to grab a binary file so that I can download it in my classic ASP page.

For whatever reason, it's throwing a "File could not be opened." error and I can't see why.

Just to eliminate the permissions aspect, I have modifified the code and proven I **CAN** open the same file for reading with the FileSystemObject. Since it's binary, the FSO's output is useless, though.

Can anybody see what I'm doing wrong (ErrHandle is my generic error handler)?

        Set objStream = Server.CreateObject("ADODB.Stream")
        if err.number <> 0 then
            ErrHandle 1, Err.Description
        end if
       
        objStream.Type = 1  ' adTypeBinary
        if err.number <> 0 then
            ErrHandle 2, Err.Description
        end if
       
        call objStream.Open()
        if err.number <> 0 then
            ErrHandle 3, Err.Description
        end if
       
        objStream.LoadFromFile strFilePath  ' <==== this fails! file CAN be opened through FSO
        if err.number <> 0 then
            ErrHandle 4, Err.Description & "<br>Number: " & cstr(err.number) & "<br>File: " & txtFile
        end if


LVL 1
kwebster7327Asked:
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.

hieloCommented:
>>ErrHandle 4, Err.Description & "<br>Number: " & cstr(err.number) & "<br>File: " & txtFile
OK, so do you have the FULL path to the file in
strFilePath or in txtFile?

If you only have the file name, try providing the FULL path - C:\folder\yourfile.jpg

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
hieloCommented:
Also, try specifying the Type AFTER you call open
kwebster7327Author Commented:
Just needed another pair of eyes. strFilePath != txtFile.

BTW, moving TYPE doesn't have an effect.
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.