Slurpee Posted June 29, 2003 Posted June 29, 2003 I've run into a bit of a problem :( I'm trying to download selected files from an arbitrary web page. The image files are to be written to a directory. private local as string = "./images" Dim FileStreamer As New FileStream(local, FileMode.Create) now I have tryed this but I'm getting a error indicatiing that I don't have permission? This is wierd as if I pass in a location to my method the code works fine. Anyone got some advice or a nice reference site? Quote
Moderators Robby Posted June 29, 2003 Moderators Posted June 29, 2003 Here's a function that works for me.. Private Sub GetImage(ByVal sDir As String, ByVal sName As String) Try Dim wc As New Net.WebClient() wc.DownloadFile(URL_IMAGE & sDir & "/" & sName, sName) wc.Dispose() Image1.Image = Image.FromFile(s)'display it in an image box Catch ex As Exception Throw New Exception(ex.Message) End Try End Sub 'URL_IMAGE is the web server location 'sDir is the directory it's in 'sName the name of the pic Quote Visit...Bassic Software
Slurpee Posted June 30, 2003 Author Posted June 30, 2003 cheers I'll try and use that code if I can :) I do have one other question though that someone may be able to answer: Reqest = HttpWebRequest.Create(sURL & Filename & Prefix) if I want to use the above code...where sURL is a URI is there a way to add the filename and prexif to the URI. Sorry if it a basic question but this is day two of web stuff :( Thanx Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.