• Log in or sign up for an account here: https://www.sythe.org/login

[code] Upload file to FTP server

  • Thread starter Thread starter rofloller
  • Start date Start date
R

rofloller

Guest
[code] Upload file to FTP server
Have fun...
Code:
Private Sub Command1_Click()
Me.Caption = "Uploading..."
If UploadFile("C:\", "file.exe", "admin", "password123", "www.jrantala.com", "crap/") Then
    MsgBox "File uploaded succefully"
End If
End Sub

Private Function UploadFile(LocalDir As String, FileName As String, username As String, password As String, FTPserver As String, remoteDir As String)
Inet.Cancel
While Inet.StillExecuting
    DoEvents
Wend

On Error GoTo err

Inet.Execute "FTP://" & username & ":" & password & "@" & FTPserver, "SEND " & Chr(34) & LocalDir & FileName & Chr(34) & " " & Chr(34) & remoteDir & FileName & Chr(34)

While Inet.StillExecuting
    DoEvents
Wend

Inet.Execute , "CLOSE"
While Inet.StillExecuting
    DoEvents
Wend
UploadFile = True
Exit Function
err:
UploadFile = False
MsgBox Error
End Function
 
[code] Upload file to FTP server
Okay, few things first...

Since this VB forum, contains many newly members who are wanting to learn how to program in VB, it might help if you put a few comments on how the code works and point out certain important parts to script.

This script wouldn't be 100% safe if i may add?
Wouldn't it be possible for someone to find out your FTP user account and password by simply hexing it... if it is reading off a text file, this is even more unsecure...

I would change your code, and add an encryption (Terrible spelling?)...
Even a basic encryption would make this code more secure...

Another thing...
Code:
Inet.Execute "FTP://" & username & ":" & password & "@" & FTPserver, "SEND " & Chr(34) & LocalDir & FileName & Chr(34) & " " & Chr(34) & remoteDir & FileName & Chr(34)

The Variables 'username', 'password', etc...
Where in the script, have you assigned them to contain a value?
 
[code] Upload file to FTP server
Code:
Inet.Execute "FTP://" & username & ":" & password & "@" & FTPserver, "SEND " & Chr(34) & LocalDir & FileName & Chr(34) & " " & Chr(34) & remoteDir & FileName & Chr(34)

The Variables 'username', 'password', etc...
Where in the script, have you assigned them to contain a value?

Are you blind?
Code:
username As String, password As String
In the function.

And when you press command1...
Code:
Me.Caption = "Uploading..."
If UploadFile("C:\", "file.exe", "admin", "password123", "www.jrantala.com", "crap/") Then
    MsgBox "File uploaded succefully"
End If
 
[code] Upload file to FTP server
Are you blind?
Code:
username As String, password As String
In the function.

And when you press command1...
Code:
Me.Caption = "Uploading..."
If UploadFile("C:\", "file.exe", "admin", "password123", "www.jrantala.com", "crap/") Then
    MsgBox "File uploaded succefully"
End If

Sorry, missed that in the function >_<

though, it is still hexable to find out your username and password to the ftp?
 
Runescape Gamblingrunescape gambling
Back
Top