Jump to content

FTP.au3 File Overwrite


 Share

Recommended Posts

Does This answer your question


Time you enjoyed wasting is not wasted time ......T.S. Elliot
Suspense is worse than disappointment................Robert Burns
God help the man who won't help himself, because no-one else will...........My Grandmother

Link to comment
Share on other sites

  • Developers

it will normally override the file unless the is a security settings issue on the target machine...

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.
  :)

Link to comment
Share on other sites

  • Developers

Not sure what you expect as an answer here.... my crystal ball isn't functioning today and hate guess work. :)

Maybe:

- tell use what you have done to test/debug..

- show some scriptlet to show what your are doing

- did you test the same thing with an FTP program and did that work ?

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.
  :)

Link to comment
Share on other sites

My Code:

$server = 'ftp.server'

$username = 'usernamehere'

$pass = 'passhere'

$dllhandle = DllOpen( 'wininet.dll' )

If $dllhandle == -1 Then

MsgBox(0, "", "Kan een vereist dll bestand niet vinden.")

EndIf

$Open = _FTPOpen('MyFTP Control')

If $Open = @error Then

MsgBox(0, "", "FOUT bij openen FTP sessie")

EndIf

$Conn = _FTPConnect($Open, $server, $username, $pass)

If $Conn = @error Then

MsgBox(0, "", "FOUT bij het verbinden/inloggen")

EndIf

$Ftpp = _FtpPutFile($Conn, @TempDir & "\request.ini", "/app/License/request.ini")

If $Ftpp = @error Then

MsgBox(0, "", "FOUT bij versturen van bestand")

EndIf

$Ftpc = _FTPClose($Open)

If $Ftpc = @error Then

MsgBox(0, "", "FOUT bij het sluiten van de FTP sessie")

EndIf

FileDelete(@TempDir & "\request.ini")

DllClose($dllhandle)

Msgbox(0, "", "Done! :) ")

Exit

EndFunc

And it does work when the file is being sent by an ftp program.

The only thing I get is 'Done! :P' , so no errors.

Edited by PcExpert
Link to comment
Share on other sites

  • Developers

Your scriptlet doesn't show how @TempDir & "\request.ini" is created ... are you sure it exists and its closed ?

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.
  :)

Link to comment
Share on other sites

This is how its created:

InetGet("http://url.here/request.ini", @TempDir & "\request.ini")

$request = IniRead(@TempDir & "\request.ini", "Global", "requests", "")

$ordernummer = $request + 1

IniWrite(@TempDir & "\request.ini", "Global", "requests", $ordernummer)

IniWrite(@TempDir & "\request.ini", "Order " & $ordernummer, "Naam", GUICtrlRead($naam))

IniWrite(@TempDir & "\request.ini", "Order " & $ordernummer, "Email", GUICtrlRead($email))

IniWrite(@TempDir & "\request.ini", "Order " & $ordernummer, "requested", @MDAY & "-" & @MON & "-" & @YEAR)

If I comment the ftp stuff, so its only edited and saved to my tempdirectory, the file has the iniwrite content.

Edited by PcExpert
Link to comment
Share on other sites

  • Developers

I am surprised to see you just keep bumping this thread without specifying any more info about what else you tried or specifying you checked security and the FTP server log etc etc ...

Try to copy the file before you upload it to ensure its available for upload.

check your FTP server setting and log files to see whats happening .....

etc...

We cannot do it for you and with the limited info given there isn't much we can do for you.

:D

Edited 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.
  :)

Link to comment
Share on other sites

I don't know whats causing your problem but I can tell you that I get exactly the same problem if I don't stop my firewall when I FTP up to my site.

George

Question about decompiling code? Read the decompiling FAQ and don't bother posting the question in the forums.

Be sure to read and follow the forum rules. -AKA the AutoIt Reading and Comprehension Skills test.***

The PCRE (Regular Expression) ToolKit for AutoIT - (Updated Oct 20, 2011 ver:3.0.1.13) - Please update your current version before filing any bug reports. The installer now includes both 32 and 64 bit versions. No change in version number.

Visit my Blog .. currently not active but it will soon be resplendent with news and views. Also please remove any links you may have to my website. it is soon to be closed and replaced with something else.

"Old age and treachery will always overcome youth and skill!"

Link to comment
Share on other sites

I tried it with my local FTP server too, but also, no results.

This is the code I use:

#include<[url="ftp://ftp.au3"]FTP.au3[/url]>
$server = 'ftp.server'
$username = 'USERNAME'
$pass = 'PASS'
$dllhandle = DllOpen( 'wininet.dll' )

$passive = 1

$Open = _FTPOpen('MyFTP Control')
$Conn = _FTPConnect($Open, $server, $username, $pass, $passive)
$Ftpp = _FtpPutFile($Conn, 'C:\WINDOWS\Notepad.exe', '/Example.exe')
$Ftpc = _FTPClose($Open)
DllClose($dllhandle)

this is the log file from the ftp server:

[5] Sat 19Jan08 16:07:15 - (000044) Connected to 192.168.1.113 (Local address 192.168.1.4)
[5] Sat 19Jan08 16:07:15 - (000044) Closing connection
[5] Sat 19Jan08 16:07:15 - (000045) Connected to 192.168.1.113 (Local address 192.168.1.4)
[5] Sat 19Jan08 16:07:15 - (000045) Closing connection
[5] Sat 19Jan08 16:07:26 - (000046) Connected to 192.168.1.113 (Local address 192.168.1.4)
[5] Sat 19Jan08 16:07:26 - (000046) User USERNAME logged in
[5] Sat 19Jan08 16:07:26 - (000047) Connected to 192.168.1.113 (Local address 192.168.1.4)
[5] Sat 19Jan08 16:07:27 - (000047) User USERNAME logged in
[5] Sat 19Jan08 16:07:28 - (000047) Closing connection for user USERNAME(00:00:02 connected)
[5] Sat 19Jan08 16:17:26 - (000046) Connection timed out
[5] Sat 19Jan08 16:17:28 - (000046) Closing connection for user USERNAME(00:10:02 connected)

What I see in the FTP server log is that its connecting, but then it immediately closes the connection. Why does it act like that? I also tried to set $passive to 0 but that didnt work.

Edited by PcExpert
Link to comment
Share on other sites

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...