Hack Forums
[.NET] FTP Upload script vbs - Printable Version

+- Hack Forums (https://hackforums.net)
+-- Forum: Tech (https://hackforums.net/forumdisplay.php?fid=444)
+--- Forum: Coding (https://hackforums.net/forumdisplay.php?fid=151)
+---- Forum: Software Development (https://hackforums.net/forumdisplay.php?fid=118)
+---- Thread: [.NET] FTP Upload script vbs (/showthread.php?tid=5803550)



FTP Upload script vbs - anonCicero - Feb 23, 2018

I am unable to get this working, I have no idea why, I'm getting Error: Object required? anyone know why? thanks.

Code
Set oShell = CreateObject("Shell.Application")
Set objFSO = CreateObject("Scripting.FileSystemObject")
'Path to file or folder to upload
path = "C:\mydir\file.txt"
FTPUpload(path)
Sub FTPUpload(path)
On Error Resume Next
'Copy Options: 16 = Yes to All
Const copyType = 16
'FTP Wait Time in ms
waitTime = 80000
FTPUser = "CHANGE THIS TO UR FTP SERVER USERNAME"
FTPPass = "CHANGE THIS TO UR FTP PASSWORD"
FTPHost = "CHANGE THIS TO UR FTP SERVER NAME EG     server29.SPAM.com"
FTPDir = "/public_html"
strFTP = "ftp://" & FTPUser & ":" & FTPPass & "@" & FTPHost & FTPDir
Set objFTP = oShell.NameSpace(strFTP)
'Make new folder on FTP site
'objFTP.NewFolder "FTP Backup"
'Upload single file      
If objFSO.FileExists(path) Then
Set objFile = objFSO.getFile(path)
strParent = objFile.ParentFolder
Set objFolder = oShell.NameSpace(strParent)
Set objItem = objFolder.ParseName(objFile.Name)
objFTP.CopyHere objItem, copyType
End If
'Upload all files in folder
If objFSO.FolderExists(path) Then
'Code below can be used to upload entire folder
Set objFolder = oShell.NameSpace(path)
objFTP.CopyHere objFolder.Items, copyType
End If
If Err.Number <> 0 Then
Wscript.Echo "Error: " & Err.Description
End If
'Wait for upload
WScript.Sleep waitTime
End Sub



RE: FTP Upload script vbs - Barret - Feb 23, 2018

In what situation is this used?


RE: FTP Upload script vbs - gigajew - Feb 23, 2018

Would VB.net or c# or even JS be an acceptable alternative? I don’t see the point of trying to mess with VBS


RE: FTP Upload script vbs - Barret - Feb 23, 2018

(Feb 23, 2018 03:10 PM)gigajew Wrote:  Would VB.net or c# or even JS be an acceptable alternative? I don’t see the point of trying to mess with VBS

prolly skiddish stuff.


RE: FTP Upload script vbs - anonCicero - Feb 23, 2018

i take that as you do not have the knowledge to answer my question


RE: FTP Upload script vbs - gigajew - Feb 23, 2018

(Feb 23, 2018 07:41 PM)anonCicero Wrote:  i take that as you do not have the knowledge to answer my question

Nor do you, which concludes that you did not even write the code in question.


RE: FTP Upload script vbs - anonCicero - Feb 23, 2018

(Feb 23, 2018 08:04 PM)gigajew Wrote:  Nor do you, which concludes that you did not even write the code in question.

i never claimed to, which is why i made the thread


RE: FTP Upload script vbs - Ninja - Feb 24, 2018

(Feb 23, 2018 07:41 PM)anonCicero Wrote:  i take that as you do not have the knowledge to answer my question

He asked you a question to help you and you didn't answer it and then you complain he doesn't have the knowledge. He literally tried to help you and you ignored it and then complained.


RE: FTP Upload script vbs - anonCicero - Feb 24, 2018

oh I didn't see, I apologize, js would be an acceptable option, sorry for my blatant rudeness and ignorance.
(Feb 23, 2018 03:10 PM)gigajew Wrote:  Would VB.net or c# or even JS be an acceptable alternative? I don’t see the point of trying to mess with VBS



RE: FTP Upload script vbs - Ninja - Feb 25, 2018

(Feb 24, 2018 04:13 PM)anonCicero Wrote:  oh I didn't see, I apologize, js would be an acceptable option, sorry for my blatant rudeness and ignorance.

I was talking about this post:
(Feb 23, 2018 01:10 PM)Barret Wrote:  In what situation is this used?