paulosergio Posted May 18, 2020 Posted May 18, 2020 where did I go wrong ? $Ftpp = _FtpPutFile($Conn, @MyDocumentsDir & 'test.jpg', '/Image' & $FileSuffix & '.jpg' , 0x08000000) this way it doesn't work for me
paulosergio Posted May 18, 2020 Author Posted May 18, 2020 i have added @MyDocumentsDir but this doesn't seem to work
Developers Jos Posted May 18, 2020 Developers Posted May 18, 2020 Aren't you missing a \ in the source file between directory and filename? SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
paulosergio Posted May 18, 2020 Author Posted May 18, 2020 29 minutes ago, Jos said: Aren't you missing a \ in the source file between directory and filename? no is not this the problem
Developers Jos Posted May 18, 2020 Developers Posted May 18, 2020 (edited) So you are saying it was already correct? What about you provide all details about what the exact content is of each variable in your code and the return code & errorcode returned from _FtpPutFile() Jos Edited May 18, 2020 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
paulosergio Posted May 18, 2020 Author Posted May 18, 2020 I'm not getting any errors but it doesn't upload the file to the ftp server in this way $Ftpp = _FtpPutFile($Conn, @MyDocumentsDir & 'GDIPlus_Image.jpg', '/Image' & $FileSuffix & '.jpg' , 0x08000000) but if i try in this way below the file is uploaded correctly $Ftpp = _FtpPutFile($Conn,"test.jpg", '/testfile.jpg' , 0x08000000)
Developers Jos Posted May 18, 2020 Developers Posted May 18, 2020 Again... You are missing a \ in the source file! Show the whole script and add logic go show the returned code and @errror.. so you at least get feedback from the function! Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
paulosergio Posted May 18, 2020 Author Posted May 18, 2020 #include <FTPEx.au3> $server = 'www.test.com' ;FTP Server $username = 'anonymous' ;FTP Username $pass = 'anonymous' ;FTP Password $Open = _FTP_Open('MyFTP Control') $Conn = _FTPConnect($Open, $server, $username, $pass,0,1,0x08000000) $FileSuffix = @MDAY & @MON & @YEAR & "-" & @HOUR & @MIN & @SEC ;Hard drive source file and server directory (change to suit) $Ftpp = _FtpPutFile($Conn, @MyDocumentsDir & 'test.jpg', '/Image' & $FileSuffix & '.jpg' , 0x08000000) Func _FTPConnect($l_InternetSession, $s_ServerName, $s_Username, $s_Password, $i_ServerPort = 0, $l_Service = 1, $l_Flags = 0, $l_Context = 0) Local $ai_InternetConnect = DllCall('wininet.dll', 'long', 'InternetConnect', 'long', $l_InternetSession, 'str', $s_ServerName, 'int', $i_ServerPort, 'str', $s_Username, 'str', $s_Password, 'long', $l_Service, 'long', $l_Flags, 'long', $l_Context) If @error OR $ai_InternetConnect[0] = 0 Then SetError(-1) Return 0 EndIf Return $ai_InternetConnect[0] EndFunc Func _FtpPutFile($l_FTPSession, $s_LocalFile, $s_RemoteFile, $l_Flags = 0, $l_Context = 0) Local $ai_FTPPutFile = DllCall('wininet.dll', 'int', 'FtpPutFile', 'long', $l_FTPSession, 'str', $s_LocalFile, 'str', $s_RemoteFile, 'long', $l_Flags, 'long', $l_Context) If @error OR $ai_FTPPutFile[0] = 0 Then SetError(-1) Return 0 EndIf Return $ai_FTPPutFile[0] EndFunc
Developers Jos Posted May 18, 2020 Developers Posted May 18, 2020 (edited) 1 hour ago, Jos said: Again... You are missing a \ in the source file! Do you understand this statement or am I wrong? @MyDocumentsDir is something like "c:\users\username\Documents" so concatenated with 'test.jpg' will result in: "c:\users\username\Documentstest.jpg" All clear now? Why aren't you using the supplied udf's in FTPex.au3? _ftp_Open() and _Ftp_FilePut() I still do not see any statements that tells you something about the success or errors returned from _FTPConnect() and _FTPPutFile()! It really would help when you stop saying it doesn't work and try to do some debugging yourself first. Something like this should tell you more when ran from within SciTE: $Ftpp = _FtpPutFile($Conn, @MyDocumentsDir & 'test.jpg', '/Image' & $FileSuffix & '.jpg' , 0x08000000) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $Ftpp = ' & $Ftpp & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console Your turn to put in some real effort. Jos Edited May 18, 2020 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past.
paulosergio Posted May 19, 2020 Author Posted May 19, 2020 9 hours ago, Jos said: Do you understand this statement or am I wrong? @MyDocumentsDir is something like "c:\users\username\Documents" so concatenated with 'test.jpg' will result in: "c:\users\username\Documentstest.jpg" All clear now? Why aren't you using the supplied udf's in FTPex.au3? _ftp_Open() and _Ftp_FilePut() I still do not see any statements that tells you something about the success or errors returned from _FTPConnect() and _FTPPutFile()! It really would help when you stop saying it doesn't work and try to do some debugging yourself first. Something like this should tell you more when ran from within SciTE: $Ftpp = _FtpPutFile($Conn, @MyDocumentsDir & 'test.jpg', '/Image' & $FileSuffix & '.jpg' , 0x08000000) ConsoleWrite('@@ Debug(' & @ScriptLineNumber & ') : $Ftpp = ' & $Ftpp & @CRLF & '>Error code: ' & @error & @CRLF) ;### Debug Console Your turn to put in some real effort. Jos yes was this the problem \ this was missing , thanks for your help, now the script works well, and I can upload it to the ftp server
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now