473,721 Members | 2,234 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

prompt "Save as" dialog for image

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!!!
Jul 22 '05 #1
8 2985
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!!!

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******** ******@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!!!


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.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!!!
>
>



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******** ******@TK2MSFTN GP14.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.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!!!
>
>



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******** ******@TK2MSFTN GP14.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.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!!!
>
>



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

Ray at home

"dave" <fo****@foo.net REMOVE> wrote in message
news:OG******** ******@TK2MSFTN GP10.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******** ******@TK2MSFTN GP15.phx.gbl...
Do you have evidence that suggests that it doesn't?

Ray at home

"dave" <fo****@foo.net REMOVE> wrote in message
news:OG******** ******@TK2MSFTN GP10.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******** ******@TK2MSFTN GP15.phx.gbl...
Do you have evidence that suggests that it doesn't?

Ray at home

"dave" <fo****@foo.net REMOVE> wrote in message
news:OG******** ******@TK2MSFTN GP10.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
5554
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. When the user clicks to start the download I would like to display the "Save As" dialog, allow the user to name a place to save the file, and then show the download progress bar while the file downloads Question: How do I make a windows "Save...
3
2550
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 a certain directory and if it doesn't meet my criteria then I want to do a "save as" to a different location. How can I do that. I can't seem to get the save as dialog to grab the filename of the file in question and ask for a place to save it....
3
6435
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=" + HttpUtility.UrlEncode("あいうえお") + ".csv"); Encoding encoding = Encoding.GetEncoding("Shift-JIS"); Response.BinaryWrite(encoding.GetBytes(csvStr)); Response.End(); It works fine..the data gets saved nicely to an excel file. The user pushes the...
60
8015
by: FAQ server | last post by:
----------------------------------------------------------------------- FAQ Topic - How do I prompt a "Save As" dialog for an accepted mime type? ----------------------------------------------------------------------- It is not possible with client-side JavaScript. Some browsers accept the Content-Disposition header, but this must be added by the server. Taking the form:- ` Content-Disposition: attachment; filename=filename.ext `
1
3889
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 process need to be automated. Whenever a document is converted to tiff MODI pops up a "Save as" dialog box which asks the path to save the converted tiff file. Now is there a way this "Save as" dialog box can be suppressed and all the files be...
0
9215
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
9131
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8007
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development projectplanning, coding, testing, and deploymentwithout human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5981
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4484
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4753
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3189
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
2576
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2130
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.