473,326 Members | 2,099 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,326 software developers and data experts.

prompt "Save as" dialog for image

Hi there
I'm trying to force save as dialogue using this code in download.asp..but
when it runs it prompts for download.asp to save or open.

code snippet (from aspfaq.com)

Response.ContentType = "application/x-unknown" ' arbitrary
fn = "wallpaper_1_1.jpg"
Response.write "<br>" & Server.MapPath("wallpaper") & "<br>"
FPath = Server.MapPath("wallpaper") & fn
Response.AddHeader "Content-Disposition","attachment; filename=" & fn

Set adoStream = CreateObject("ADODB.Stream")
adoStream.Open()
adoStream.Type = 1
adoStream.LoadFromFile(FPath)
Response.BinaryWrite adoStream.Read()
adoStream.Close
Set adoStream = Nothing
I want this page to prompt save image option, not page itself.

Any help would be appreciated!!!
Jul 22 '05 #1
8 2961
Are you accessing the page via http? Like, you're going to
http://localhost/download.asp as opposed to C:\Inetpub\wwwroot\download.asp?

Ray at work
"dave" <fo****@foo.netREMOVE> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Hi there
I'm trying to force save as dialogue using this code in download.asp..but
when it runs it prompts for download.asp to save or open.

code snippet (from aspfaq.com)

Response.ContentType = "application/x-unknown" ' arbitrary
fn = "wallpaper_1_1.jpg"
Response.write "<br>" & Server.MapPath("wallpaper") & "<br>"
FPath = Server.MapPath("wallpaper") & fn
Response.AddHeader "Content-Disposition","attachment; filename=" & fn

Set adoStream = CreateObject("ADODB.Stream")
adoStream.Open()
adoStream.Type = 1
adoStream.LoadFromFile(FPath)
Response.BinaryWrite adoStream.Read()
adoStream.Close
Set adoStream = Nothing
I want this page to prompt save image option, not page itself.

Any help would be appreciated!!!

Jul 22 '05 #2
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**************@TK2MSFTNGP14.phx.gbl...
Are you accessing the page via http? Like, you're going to
http://localhost/download.asp as opposed to C:\Inetpub\wwwroot\download.asp?
Ray at work
"dave" <fo****@foo.netREMOVE> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
Hi there
I'm trying to force save as dialogue using this code in download.asp..but when it runs it prompts for download.asp to save or open.

code snippet (from aspfaq.com)

Response.ContentType = "application/x-unknown" ' arbitrary
fn = "wallpaper_1_1.jpg"
Response.write "<br>" & Server.MapPath("wallpaper") & "<br>"
FPath = Server.MapPath("wallpaper") & fn
Response.AddHeader "Content-Disposition","attachment; filename=" & fn

Set adoStream = CreateObject("ADODB.Stream")
adoStream.Open()
adoStream.Type = 1
adoStream.LoadFromFile(FPath)
Response.BinaryWrite adoStream.Read()
adoStream.Close
Set adoStream = Nothing
I want this page to prompt save image option, not page itself.

Any help would be appreciated!!!


Jul 22 '05 #3
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.ContentType = "application/x-unknown" ' arbitrary
fn = "wallpaper_1_1.jpg"
'Response.write "<br>" & Server.MapPath("wallpaper") & "<br>"
FPath = Server.MapPath("wallpaper") & "\" & fn
Response.AddHeader "Content-Disposition","attachment; filename=" & fn

Set adoStream = CreateObject("ADODB.Stream")
adoStream.Open()
adoStream.Type = 1
adoStream.LoadFromFile(FPath)
Response.BinaryWrite adoStream.Read()
adoStream.Close
Set adoStream = Nothing

Ray at home

"dave" <fo****@foo.netREMOVE> wrote in message
news:eQ**************@TK2MSFTNGP11.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**************@TK2MSFTNGP14.phx.gbl...
Are you accessing the page via http? Like, you're going to
http://localhost/download.asp as opposed to

C:\Inetpub\wwwroot\download.asp?

Ray at work
"dave" <fo****@foo.netREMOVE> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
> Hi there
> I'm trying to force save as dialogue using this code in download.asp..but > when it runs it prompts for download.asp to save or open.
>
> code snippet (from aspfaq.com)
>
> Response.ContentType = "application/x-unknown" ' arbitrary
> fn = "wallpaper_1_1.jpg"
> Response.write "<br>" & Server.MapPath("wallpaper") & "<br>"
> FPath = Server.MapPath("wallpaper") & fn
> Response.AddHeader "Content-Disposition","attachment; filename=" &
> fn
>
> Set adoStream = CreateObject("ADODB.Stream")
> adoStream.Open()
> adoStream.Type = 1
> adoStream.LoadFromFile(FPath)
> Response.BinaryWrite adoStream.Read()
> adoStream.Close
> Set adoStream = Nothing
>
>
> I want this page to prompt save image option, not page itself.
>
> Any help would be appreciated!!!
>
>



Jul 22 '05 #4
yeh man, it worked
thanx for help
dev

"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:eg**************@TK2MSFTNGP14.phx.gbl...
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.ContentType = "application/x-unknown" ' arbitrary
fn = "wallpaper_1_1.jpg"
'Response.write "<br>" & Server.MapPath("wallpaper") & "<br>"
FPath = Server.MapPath("wallpaper") & "\" & fn
Response.AddHeader "Content-Disposition","attachment; filename=" & fn

Set adoStream = CreateObject("ADODB.Stream")
adoStream.Open()
adoStream.Type = 1
adoStream.LoadFromFile(FPath)
Response.BinaryWrite adoStream.Read()
adoStream.Close
Set adoStream = Nothing

Ray at home

"dave" <fo****@foo.netREMOVE> wrote in message
news:eQ**************@TK2MSFTNGP11.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**************@TK2MSFTNGP14.phx.gbl...
Are you accessing the page via http? Like, you're going to
http://localhost/download.asp as opposed to

C:\Inetpub\wwwroot\download.asp?

Ray at work
"dave" <fo****@foo.netREMOVE> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
> Hi there
> I'm trying to force save as dialogue using this code in

download.asp..but
> when it runs it prompts for download.asp to save or open.
>
> code snippet (from aspfaq.com)
>
> Response.ContentType = "application/x-unknown" ' arbitrary
> fn = "wallpaper_1_1.jpg"
> Response.write "<br>" & Server.MapPath("wallpaper") & "<br>"
> FPath = Server.MapPath("wallpaper") & fn
> Response.AddHeader "Content-Disposition","attachment; filename=" &
> fn
>
> Set adoStream = CreateObject("ADODB.Stream")
> adoStream.Open()
> adoStream.Type = 1
> adoStream.LoadFromFile(FPath)
> Response.BinaryWrite adoStream.Read()
> adoStream.Close
> Set adoStream = Nothing
>
>
> I want this page to prompt save image option, not page itself.
>
> Any help would be appreciated!!!
>
>



Jul 22 '05 #5
just one question
how do i make this code to work with most common all browser
dev

"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:eg**************@TK2MSFTNGP14.phx.gbl...
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.ContentType = "application/x-unknown" ' arbitrary
fn = "wallpaper_1_1.jpg"
'Response.write "<br>" & Server.MapPath("wallpaper") & "<br>"
FPath = Server.MapPath("wallpaper") & "\" & fn
Response.AddHeader "Content-Disposition","attachment; filename=" & fn

Set adoStream = CreateObject("ADODB.Stream")
adoStream.Open()
adoStream.Type = 1
adoStream.LoadFromFile(FPath)
Response.BinaryWrite adoStream.Read()
adoStream.Close
Set adoStream = Nothing

Ray at home

"dave" <fo****@foo.netREMOVE> wrote in message
news:eQ**************@TK2MSFTNGP11.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**************@TK2MSFTNGP14.phx.gbl...
Are you accessing the page via http? Like, you're going to
http://localhost/download.asp as opposed to

C:\Inetpub\wwwroot\download.asp?

Ray at work
"dave" <fo****@foo.netREMOVE> wrote in message
news:%2****************@TK2MSFTNGP15.phx.gbl...
> Hi there
> I'm trying to force save as dialogue using this code in

download.asp..but
> when it runs it prompts for download.asp to save or open.
>
> code snippet (from aspfaq.com)
>
> Response.ContentType = "application/x-unknown" ' arbitrary
> fn = "wallpaper_1_1.jpg"
> Response.write "<br>" & Server.MapPath("wallpaper") & "<br>"
> FPath = Server.MapPath("wallpaper") & fn
> Response.AddHeader "Content-Disposition","attachment; filename=" &
> fn
>
> Set adoStream = CreateObject("ADODB.Stream")
> adoStream.Open()
> adoStream.Type = 1
> adoStream.LoadFromFile(FPath)
> Response.BinaryWrite adoStream.Read()
> adoStream.Close
> Set adoStream = Nothing
>
>
> I want this page to prompt save image option, not page itself.
>
> Any help would be appreciated!!!
>
>



Jul 22 '05 #6
Do you have evidence that suggests that it doesn't?

Ray at home

"dave" <fo****@foo.netREMOVE> wrote in message
news:OG**************@TK2MSFTNGP10.phx.gbl...
just one question
how do i make this code to work with most common all browser
dev

Jul 22 '05 #7
no..but
"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:#b**************@TK2MSFTNGP15.phx.gbl...
Do you have evidence that suggests that it doesn't?

Ray at home

"dave" <fo****@foo.netREMOVE> wrote in message
news:OG**************@TK2MSFTNGP10.phx.gbl...
just one question
how do i make this code to work with most common all browser
dev


Jul 22 '05 #8
no but
http://www.aspfaq.com/show.asp?id=2161
in last lines of articles says u might have to change addheader lines to get
correct filename...
thts wht puzzling me
dave

"Ray Costanzo [MVP]" <my first name at lane 34 dot commercial> wrote in
message news:#b**************@TK2MSFTNGP15.phx.gbl...
Do you have evidence that suggests that it doesn't?

Ray at home

"dave" <fo****@foo.netREMOVE> wrote in message
news:OG**************@TK2MSFTNGP10.phx.gbl...
just one question
how do i make this code to work with most common all browser
dev


Jul 22 '05 #9

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

Similar topics

4
by: Richard | last post by:
Hi I'm new to ASP/Web programming so any help would be appreciated... Situation: On my web page I would like to present a link {or button} that would allow the user to download a large file. ...
3
by: B-Dog | last post by:
I'm checking some files to see if the filenames are in a certain format and if not I want to pull up a dialog box that gives me a save as with the file that is in question. I have all the files in...
3
by: =?Utf-8?B?YXNkZg==?= | last post by:
Hello. I am making a web application with c# and am using this code: Response.ContentType = "application/x-excel"; Response.AddHeader("Content-Disposition", "attachment;filename=" +...
60
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I prompt a "Save As" dialog for an accepted mime type?...
1
by: sainathparuchuri | last post by:
As a project requirement we need to convert word documents to tiff images. We have been using Microsoft Office Document Image Writer (MODI) for this puspose and doing absolutely well. But now this...
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...
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: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
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...
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)...
1
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
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....
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

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.