FTP Uploader[Not .TXT - image]
Do you need something made? then ask in here.
Forum rules
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
Please LOCK your topics once you have found the solution to your question so we know you no longer require help with your query.
7 posts
Page 1 of 1
he i want to upload some images to my website with my program
i used ftp chat's tutorial
so i need your help thanx,,
i used ftp chat's tutorial
Code: Select all
but mm it failed :( Try
Dim client As New Net.WebClient
client.Credentials = New Net.NetworkCredential("xxx", "xxx")
client.UploadString("ftp://nexonsux.megabyte.net/" & TextBox1.Text, ofd.FileName)
MsgBox("Image Uploaded", MsgBoxStyle.Information)
Catch ex As Exception
MsgBox("Image Could Not Upload", MsgBoxStyle.Critical, "Error!")
End Try
so i need your help thanx,,
Check out http://msdn.microsoft.com/en-us/library/ms229715.aspx
UploadString is usually only used in HTTP requests, not FTP.
UploadString is usually only used in HTTP requests, not FTP.
i am getting this error : This language is not supported or no code example is available.
NecroPhis wrote:i am getting this error : This language is not supported or no code example is available.Yeah I even used a C3 to VB converter software ( http://converter.telerik.com/ )
I even tried it on a few diffrerent website and it wasnt able to be converted do to some line error within the code.
If you just need a code snippet that will upload via FTP
Try this
Code: Select all
' set up request...
Dim clsRequest As System.Net.FtpWebRequest = DirectCast(System.Net.WebRequest.Create("ftp://SOMEFTPSITE.COM/somefilename.txt), System.Net.FtpWebRequest)
'THIS IS A MUST. You must have a FTP User's Account login information
clsRequest.Credentials = New System.Net.NetworkCredential("USERNAME", "PASSWORD")
clsRequest.Method = System.Net.WebRequestMethods.Ftp.UploadFile
' read in file...
Dim bFile() As Byte = System.IO.File.ReadAllBytes(filepath)
' upload file...
Dim clsStream As System.IO.Stream = clsRequest.GetRequestStream()
clsStream.Write(bFile, 0, bFile.Length)
clsStream.Close()
clsStream.Dispose()
2 errors:
Code: Select all
clsRequest.Credentials = New System.Net.NetworkCredential("USERNAME", "PASSWORD")
clsRequest.Method = System.Net.WebRequestMethods.Ftp.UploadFile
NecroPhis wrote:2 errors:Code: Select allclsRequest.Credentials = New System.Net.NetworkCredential("USERNAME", "PASSWORD") clsRequest.Method = System.Net.WebRequestMethods.Ftp.UploadFile
Did you read the line just above that?
It said.
'THIS IS A MUST. You must have a FTP User's Account login information
clsRequest.Credentials = New System.Net.NetworkCredential("USERNAME", "PASSWORD")
clsRequest.Method = System.Net.WebRequestMethods.Ftp.UploadFile
This means where "USERNAME" and "PASSWORD" is, you replace "USERNAME" and "PASSWORD" with your ftp username and password
example:
ftp://someftpsite.com
then a window will hask you for a Username and a Password.
The ftp Username and Password that you use to access the ftp site is what you would use in the section that says "USERNAME" and "PASSWORD"
Those "2 Errors" came from you not filling in the "USERNAME" and "PASSWORD" for the ftp site that you are trying to access.
Hello,
You cant just use the quickest way?:
You cant just use the quickest way?:
Code: Select all
Works ok for me with any file type cooll; .My.Computer.Network.UploadFile("NameOfFileToUpload.ext", "ftp://www.YOURSITE.com/NameOfFileToSaveItAs.ext", "USERNAME", "PASSWORD", True, 10, FileIO.UICancelOption.DoNothing)
Welcome to CodenStuff.com Learn Code, Love Code. Thank you for being a member of the community.
7 posts
Page 1 of 1
Copyright Information
Copyright © Codenstuff.com 2020 - 2023