Do you have an On Error Resume Next? Well, regardless, a couple of changes
will be necessary.
When you Response.write FPath, did you notice that there was no \ between
the directory name and the filename? You'll need that. Also, make sure you
do not leave the Response.Write code in there when you get this working.
Try this code:
Response.Conten tType = "applicatio n/x-unknown" ' arbitrary
fn = "wallpaper_1_1. jpg"
'Response.write "<br>" & Server.MapPath( "wallpaper" ) & "<br>"
FPath = Server.MapPath( "wallpaper" ) & "\" & fn
Response.AddHea der "Content-Disposition","a ttachment; filename=" & fn
Set adoStream = CreateObject("A DODB.Stream")
adoStream.Open( )
adoStream.Type = 1
adoStream.LoadF romFile(FPath)
Response.Binary Write adoStream.Read( )
adoStream.Close
Set adoStream = Nothing
Ray at home
"dave" <fo****@foo.net REMOVE> wrote in message
news:eQ******** ******@TK2MSFTN GP11.phx.gbl...
yes
i m accessling thru http:
http://localhost/download.asp
and its asking me open, save,cancel options
dave
"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:Of******** ******@TK2MSFTN GP14.phx.gbl... Are you accessing the page via http? Like, you're going to
http://localhost/download.asp as opposed to
C:\Inetpub\wwwr oot\download.as p?
Ray at work
"dave" <fo****@foo.net REMOVE> wrote in message
news:%2******** ********@TK2MSF TNGP15.phx.gbl. .. > Hi there
> I'm trying to force save as dialogue using this code in download.asp..b ut > when it runs it prompts for download.asp to save or open.
>
> code snippet (from aspfaq.com)
>
> Response.Conten tType = "applicatio n/x-unknown" ' arbitrary
> fn = "wallpaper_1_1. jpg"
> Response.write "<br>" & Server.MapPath( "wallpaper" ) & "<br>"
> FPath = Server.MapPath( "wallpaper" ) & fn
> Response.AddHea der "Content-Disposition","a ttachment; filename=" &
> fn
>
> Set adoStream = CreateObject("A DODB.Stream")
> adoStream.Open( )
> adoStream.Type = 1
> adoStream.LoadF romFile(FPath)
> Response.Binary Write adoStream.Read( )
> adoStream.Close
> Set adoStream = Nothing
>
>
> I want this page to prompt save image option, not page itself.
>
> Any help would be appreciated!!!
>
>