FTP Help

Christopherx

Well-known member
Joined
Jul 4, 2010
Messages
58
Programming Experience
Beginner
Writing to a text file over the internet.

Dim url As String
url = "http://swrpdatabase.comli.com/Dubstep%20Tunes.html"
Dim req As WebRequest = WebRequest.Create(url)
Dim resp As WebResponse = req.GetResponse
Dim streams As Stream = resp.GetResponseStream


Dim reader As New StreamReader(streams)

Console.WriteLine(reader.ReadToEnd)
reader.Close()
Console.ReadKey()

This is my code to read a file from the internet. I have heard from a friend however, i can not use the streamwriter class because it does not support URIs. Any help would be greatly appreciated :)

Im using Vb.net 2008 express edition btw.
 
Last edited by a moderator:
Imports System.Net
Imports System.Net.Sockets
Imports System.IO
Module Upload
Sub main()

My.Computer.Network.UploadFile("http://swrpdatabase.comli.com", "C:\teser.txt")
Console.WriteLine("YAY!")
Console.ReadKey()



End Sub

End Module

URI formats are not supported. Oh god please help meeee!! haha :)
 
Sub main()

Dim path As String = "C:\Users\Chris\Documents\new1.txt"
If File.Exists(path) Then
File.Delete(path)
End If
My.Computer.Network.DownloadFile("http://swrpdatabase.comli.com/ToHoldInfo.txt", path)
FileOpen(1, path, OpenMode.Append, OpenAccess.Write)
PrintLine(1, "****")
FileClose(1)

My.Computer.Network.UploadFile(path, "http://swrpdatabase.comli.com/ToHoldInfo.txt")
Console.WriteLine("YAY!")
Console.ReadKey()



End Sub

That doesn't work :(
 
Re "FTP Help": You're not using Ftp, you try to upload to Http, which is normally not permitted. Ftp addresses start with ftp:// and normally you have to supply credentials as well.
 
Need Help with FTP Protocol

Sub main()

Dim path As String = "C:\Users\Chris\Documents\new1.txt"
If File.Exists(path) Then
File.Delete(path)
End If
My.Computer.Network.DownloadFile("http://swrpdatabase.comli.com/Dubstep%20Tunes.html", path)

Dim sw As New StreamWriter(path)
sw.WriteLine("anker")
sw.Close()


My.Computer.Network.UploadFile(path, "http://swrpdatabase.comli.com/Dubstep%20Tunes2.html")
Console.WriteLine("YAY!")
Console.ReadKey()



End Sub

So as far as I can tell, this thing should work. the programme runs the code all the way through without any problems. what's going wrong ? :(
 
Back
Top