Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

image download dialog

Status
Not open for further replies.

thompom

Technical User
Dec 4, 2006
395
0
0
GB
Hi - am using the following to popup a 'save as' dialog

Code:
    Response.ContentType = "image/GIF" ' arbitrary 
    fn = x_url '"whatever.jpg" 
    FPath = "c:\" & 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 
 
    Response.End

the save as dialog popsup, and i click save but then get an error

Code:
Internet explorer cannot download myfile.gif from localhost.
Internet explorer was not able to open this internet site.

any ideas welcome - have read this could be a buffer problem ?

 
You should try with some static file like in this example
Code:
    fn = "loading.gif"
    FPath = "C:\temp\" & fn 
    Response.ContentType = "image/GIF" ' arbitrary 
    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

This works on my machine. Maybe your file name isnt right.
Can you show an example of how the fn name would look like?


________
George, M
Searches(faq333-4906),Carts(faq333-4911)
 
hi - thx for your reply my fn was a full URL and this was the problem
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top