Re: File could not be opened

Tech-Archive recommends: Fix windows errors by optimizing your registry




"panda" <panda@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:A276E5F7-1CFF-4305-922A-167EF6FFA31E@xxxxxxxxxxxxxxxx
Hi,

I have not done a Respose.write anywhere in the ASP file. However, i did
manage to solve the problem.

Apparently ASP's LoadFromFile does not like xx & xxx. It needs to be one
object. So i created

Dim yy
yy = xx & xxx

and then did the LoadFRomFile yy

It's highly unlikely that that was the fix.

LoadFromFile is not responsible for the parsing and evaluating xx & xxx.
It's more likely something else in your code changed that has fixed this.


this works.

Thank you for your time in reading my post.

Many thanks

"Anthony Jones" wrote:


"panda" <panda@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:0F605B6B-C5AE-43EC-9C6D-808FAC60870A@xxxxxxxxxxxxxxxx
Hi,

I have an ASP page and i want to force download an image to the user.
I
have
the following code

<%
'--------------------------------------------
Response.Buffer = True
Dim strFilePath, strFileSize, strFileName
Const adTypeBinary = 1
strFilePath = server.mappath("\images\" & request.querystring("cat") &
"\")
strFileSize = 99
strFileName = request.querystring("file")
Response.Clear
'8*******************************8
' Requires MDAC 2.5 to be stable
' I recommend MDAC 2.6 or 2.7
'8*******************************8
Set objStream = Server.CreateObject("ADODB.Stream")
objStream.Open
objStream.Type = adTypeBinary
objStream.LoadFromFile strFilePath & strFileType
strFileType = lcase(Right(strFileName, 4))
' Feel Free to Add Your Own Content-Types Here
Select Case strFileType
Case ".gif"
ContentType = "image/gif"
Case ".jpg", "jpeg"
ContentType = "image/jpeg"
Case Else
'Handle All Other Files
ContentType = "application/octet-stream"
End Select
Response.AddHeader "Content-Disposition", "attachment; filename=" &
strFileName
Response.AddHeader "Content-Length", strFileSize
' In a Perfect World, Your Client would also have UTF-8 as the default
' In Their Browser
Response.Charset = "UTF-8"
Response.ContentType = ContentType
Response.BinaryWrite objStream.Read
Response.Flush
objStream.Close
Set objStream = Nothing
%>

I have checked the path that it tries to look at,

You've done:-

Response.Write strFilePath & strFileType
Response.End

Just before the LoadFromFile and seen the correct physical path?

and it is correct. I also
have read and write permission on the images directory for everybody
and
anonymous internet user.

Is the file read-only?

Add the images folder as a virtual folder to the website temporarily,
can
you access the images via that virtual folder as they would in a typical
site?




But I still get



Error Type:
ADODB.Stream (0x800A0BBA)
File could not be opened.
/ImageBank/NewImageBank/download.asp, line 17

What am i doing wrong?

thanks





.



Relevant Pages

  • Re: File could not be opened
    ... I have not done a Respose.write anywhere in the ASP file. ... Apparently ASP's LoadFromFile does not like xx & xxx. ... objStream.LoadFromFile strFilePath & strFileType ... Add the images folder as a virtual folder to the website temporarily, ...
    (microsoft.public.inetserver.asp.components)
  • Re: File could not be opened
    ... objStream.LoadFromFile strFilePath & strFileType ... Just before the LoadFromFile and seen the correct physical path? ... Add the images folder as a virtual folder to the website temporarily, ...
    (microsoft.public.inetserver.asp.components)