Wrox Programmer Forums
|
Classic ASP Components Discussions specific to components in ASP 3.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Components section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old June 18th, 2005, 08:25 AM
Registered User
 
Join Date: Jun 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Downloading Images

Hi,

I have an image getting displayed on a page.I want to add to hyperlinks below it to download the image at high and low resolution.How can I do that.Please advice.

Thanks,
Priti

 
Old June 18th, 2005, 08:31 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

treat it like a document, place it in an anchor tag. You will obviously need two of them, one for each image.


Wind is your friend
Matt
 
Old June 19th, 2005, 03:33 AM
Registered User
 
Join Date: Jun 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks for replying matt.I did as you suggested

I tried using an anchor like this giving path using 'http' and mentioning the drive::

<a href="http://server_name/images/HIGH_RES_IMAGE_NAME.gif">Download High resolution image</a>


<a href="f:/images/HIGH_RES_IMAGE_NAME.gif">Download High resolution image</a>

With that, on click of hyperlink the image gets opened up in same browser window and doesnot pop up for download.

Priti

 
Old June 19th, 2005, 03:47 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You may want to take a look at this FAQ: http://Imar.Spaanjaars.Com/QuickDocId.aspx?QUICKDOC=189

It explains how to force the Save As dialog with an ASP page...

HtH,

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old June 19th, 2005, 06:08 PM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 1,870
Thanks: 12
Thanked 20 Times in 20 Posts
Send a message via AIM to mat41
Default

Imar - Five stars fot that article, very helpful.

Wind is your friend
Matt
 
Old June 21st, 2005, 07:34 AM
Registered User
 
Join Date: Jun 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hello,

Thanks a lot,the article was good and very useful.I have a parent page which open the page in new window focing save as dialog box.After the user has saved the file the window remain closed.How to close the window.As if I write javascript as mentioned below it does not goes to the browser.

<%
    FileName = request.querystring("Filename")
    FullFileName = "F:/inetpub/wwwroot/download/"&FileName
    Response.ContentType = "application/x-unknown"
    Response.Addheader "Content-Disposition", "attachment; filename=" & chr(34) & FileName & chr(34)
    Response.Binarywrite GetBinaryFile(FullFileName)

    Function GetBinaryFile(ByRef FileSpec)
        Const adTypeBinary = 1
        Dim objStream
        Set objStream = Server.Createobject("ADODB.Stream")
        objStream.Open()
        objStream.Type = adTypeBinary
        objStream.LoadFromFile FileSpec
        GetBinaryFile = objStream.Read()

        Set objStream = Nothing
    End Function
%>

<html>
<head>
<script language="Javascript">
function cls()
{
window.close();

}

</script>
</head>
<body onload=cls()>

</body>
</html>


Thanks,
Priti

 
Old June 21st, 2005, 07:37 AM
Registered User
 
Join Date: Jun 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

further to my reply if i try to close the child window through javascript in parent window then the save as dialog box does not appear and the child window gets closed without doing anything.

Thanks,
Priti

 
Old June 21st, 2005, 02:34 PM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

You don't need an additional window. Just link to the page directly. The browser will see you're downloading a file and leave the current page in tact.

So, something like:

<a href="DownloadFile.asp?Id=123">Download</a>

would work fine. It shows the download dialog as a separate dialog, without affecting the page that has the link.

Does this help?

Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
 
Old June 23rd, 2005, 05:49 AM
Registered User
 
Join Date: Jun 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Thanks a lot Imar.It worked.

Priti.

 
Old September 11th, 2005, 10:55 PM
Registered User
 
Join Date: Sep 2005
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to alphyne
Default

I have made similar code, however, after the force-download dialog appeared, is it possible to detect if user press "Cancel" button?.


-Ian-





Similar Threads
Thread Thread Starter Forum Replies Last Post
Load Images from and Save Images to a Database cyndie VB.NET 2 August 17th, 2008 06:42 AM
Downloading Images priti VBScript 3 June 21st, 2005 02:08 AM
Downloading scripts... johnh Oracle 0 May 23rd, 2004 10:17 AM
Problem in downloading KamranAhmed VB How-To 0 May 12th, 2004 03:08 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.