| | |
how to download image physical files from other server through URL
Please support our ASP advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
![]() |
•
•
Join Date: Aug 2006
Posts: 24
Reputation:
Solved Threads: 0
hello..i got some question about downloding and save the image from other server to my server and also change the file name.
i have no idea on it. i hope can get some help from here.
let say i have a url that pass back from the Picnik API like this:
http://www.picnik.com/file/abc.jpg
i would like to get this image physical files and save it into my server, and replace it to my original image.
how can i do it? using aspjepg? or aspsmart upload?
thanx..hope to hear from u all soon...
thank you very very much
i have no idea on it. i hope can get some help from here.
let say i have a url that pass back from the Picnik API like this:
http://www.picnik.com/file/abc.jpg
i would like to get this image physical files and save it into my server, and replace it to my original image.
how can i do it? using aspjepg? or aspsmart upload?
thanx..hope to hear from u all soon...
thank you very very much
right click on the image... save as... then upload it to your server or photobucket or imageshack.....
In photobucket you can put the URL in and then it uploads that photo to your account.
Done
In photobucket you can put the URL in and then it uploads that photo to your account.
Done
Last edited by cohen; Nov 3rd, 2008 at 9:08 pm.
Aren't you forgetting something cohen? What about copyrights?
Learn to see in another's calamity the ills which you should avoid.
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
Publilius Syrus
(~100 BC)
LJC - London Java Community, Graduate & Undergraduate Software Development Community, JAVAWUG (Java Web User Group), The London Android Group
•
•
Join Date: Feb 2007
Posts: 66
Reputation:
Solved Threads: 4
Hi,
aside the mentioned restrictions, saving images on your server would be quite difficult. Usually the images are sent to the browser, that means you have to use a virtual browser in order to get the image onto your server. A browser receives all images, in this case your server would receive many images from the other server.
aside the mentioned restrictions, saving images on your server would be quite difficult. Usually the images are sent to the browser, that means you have to use a virtual browser in order to get the image onto your server. A browser receives all images, in this case your server would receive many images from the other server.
You guys sure give up easy 
I wrote this little script for you guys, examples included.

I wrote this little script for you guys, examples included.
asp Syntax (Toggle Plain Text)
<% 'Fetch and save this image Call fetchDocument("http://www.iportalx.net/images/iportalx-welcome.gif", Server.MapPath("./")) 'Fetech and save this document Call fetchDocument("http://www.daniweb.com/forums/thread153966.html", Server.MapPath("./")) 'Created by Drew Gauderman 'Website: [url]http://www.iportalx.net[/url] Function fetchDocument(strDocURL, strSavePath) 'Create the XMLHTTP object to fetch the image Set objXmlHTTP = Server.CreateObject("Microsoft.XMLHTTP") 'Get the image objXmlHTTP.Open "GET", strDocURL, False objXmlHTTP.Send 'Create Stream object Dim objStream Set objStream = Server.CreateObject("ADODB.Stream") With objStream 'Specify stream type - we want To save binary data. .Type = 1 'Open the stream And write binary data To the object .Open .Write objXmlHTTP.ResponseBody 'Save binary data To disk .SaveToFile strSavePath & "/" & Mid(strDocURL, InstrRev(strDocURL, "/")), 2 'Clean up objects .Close End WIth Set objXmlHTTP = Nothing Set objStream = Nothing End Function %>
Last edited by Drew; Nov 19th, 2008 at 5:09 pm. Reason: added asp code highlighting
•
•
Join Date: Nov 2008
Posts: 1
Reputation:
Solved Threads: 0
Drew,
You rock! This is just what I was looking for... I was searching for a way to save webpage thumbnails created from websnapr.com for my website: <URL SNIPPED>
I could have used websnapr to dynamically create the thumbnails each time the page was loaded, but figured if I could save them it would be better/easier to controll.... also, by saving the images I can include them in my RSS feed (websnapr images dont work with RSS).
Anyhow, thanks Drew for your awesome and simple example... here's teh code I used:
This way I can save the image to the path I want and also save the filename using a key-identifier with the record I'm saving... making it easy to dynamically create and delete.
Thanks again.
~Mikel
You rock! This is just what I was looking for... I was searching for a way to save webpage thumbnails created from websnapr.com for my website: <URL SNIPPED>
I could have used websnapr to dynamically create the thumbnails each time the page was loaded, but figured if I could save them it would be better/easier to controll.... also, by saving the images I can include them in my RSS feed (websnapr images dont work with RSS).
Anyhow, thanks Drew for your awesome and simple example... here's teh code I used:
<%
'Fetch and save this image
'Call fetchDocument("http://www.iportalx.net/images/iportalx-welcome.gif", Server.MapPath("./"), "myimagename.jpg")
'Fetech and save this document
'Call fetchDocument("http://www.daniweb.com/forums/thread153966.html", Server.MapPath("./"), "mydocumentname.doc"))
'Created by Drew Gauderman
'Website: http://www.iportalx.net
Function fetchDocument(strDocURL, strSavePath, newImageName)
'Create the XMLHTTP object to fetch the image
Set objXmlHTTP = Server.CreateObject("Microsoft.XMLHTTP")
'Get the image
objXmlHTTP.Open "GET", strDocURL, False
objXmlHTTP.Send
'Create Stream object
Dim objStream
Set objStream = Server.CreateObject("ADODB.Stream")
With objStream
'Specify stream type - we want To save binary data.
.Type = 1
'Open the stream And write binary data To the object
.Open
.Write objXmlHTTP.ResponseBody
'Save binary data To disk
.SaveToFile strSavePath & "\" & newImageName
'Clean up objects
.Close
End WIth
Set objXmlHTTP = Nothing
Set objStream = Nothing
End Function
%>This way I can save the image to the path I want and also save the filename using a key-identifier with the record I'm saving... making it easy to dynamically create and delete.
Thanks again.
~Mikel
Last edited by peter_budo; Nov 29th, 2008 at 5:31 am. Reason: Keep It Spam-Free - Do not spam, advertise, plug your website, or engage in any other type of self promotion.
•
•
Join Date: Sep 2008
Posts: 2
Reputation:
Solved Threads: 0
this is a solution how to save image from url to your server:
1. get Stream from URL using WebRequest class
2. Create Image object from stream using System.Drawing.Image.FromStream method
3. Save file on disk using System.Drawing.Image.Save method
details:
http://mxdev.blogspot.com/2008/12/ge...et-aspnet.html
or you mean "server" is not the server from which code is executed?
1. get Stream from URL using WebRequest class
2. Create Image object from stream using System.Drawing.Image.FromStream method
3. Save file on disk using System.Drawing.Image.Save method
details:
http://mxdev.blogspot.com/2008/12/ge...et-aspnet.html
or you mean "server" is not the server from which code is executed?
•
•
•
•
hello..i got some question about downloding and save the image from other server to my server and also change the file name.
i have no idea on it. i hope can get some help from here.
let say i have a url that pass back from the Picnik API like this:
http://www.picnik.com/file/abc.jpg
i would like to get this image physical files and save it into my server, and replace it to my original image.
how can i do it? using aspjepg? or aspsmart upload?
thanx..hope to hear from u all soon...
thank you very very much
![]() |
Similar Threads
- SpeedUp Your Window XP Never Than Before (Windows tips 'n' tweaks)
- hijackthis.exe is not a valid win32 application (Viruses, Spyware and other Nasties)
- memory management in wndows 2000 (Windows NT / 2000 / XP)
- I've been getting A LOT of pos.tmp etc. files in my C: Drive (Viruses, Spyware and other Nasties)
- backdoor.huai (Viruses, Spyware and other Nasties)
- Tutorials for Linux (*nix Software)
Other Threads in the ASP Forum
- Previous Thread: data transfer with encrypted format
- Next Thread: How to display online users Details( username ) and count Using ASP
| Thread Tools | Search this Thread |
archive asp asp.net aspandmssqlserver2005 aspandmssqlserver2005connection aspconnection connection database databaseconnection dreamweaver excel fso iis msmsql mssql2005 mssqlserver2005 mssqlserver2005andasp mssqlserverandasp opentextfile record searchbox selectoption single specfic sqlserver sqlserverconnection windows7






