Jump to content

FTP ini file


 Share

Recommended Posts

Hi, all,

How can I put the variable into a ini file and read the settings rather then I use it now

#include <FTPEx.au3>

$server = 'site.nl' ;Server gegevens om te uploaden

$username = 'user' ;Gebruikersnaam

$pass = 'XXXXXXX' ;Wachtwoord

$Bestand = 'ton.txt' ;Het bestand om te uploaden

$Path = '/httpdocs/0/' ;De juiste directory waar het te up te loaden bestand komt te staan

$Open = _FTP_Open('MyFTP Control')

$Conn = _FTP_Connect($Open, $server, $username, $pass, 1)

$upload = _FTP_FilePut($Conn, $Bestand, $Path&$Bestand)

$Ftpc = _FTP_Close($Open)

Thanks for any help in advance

T

Link to comment
Share on other sites

First, create an ini file with info like this in it (note: do not put spaces around the equals sign):

[FTPInfo]
server='site.nl'
username='user'
pass='XXXXXXX'
Bestand='ton.txt'
Path='/httpdocs/0/'

Then your script should read the information from the file like so:

$dataFile = "data.ini"
$server = IniRead($dataFile, "FTPInfo", "server", "Not Found")
$username = IniRead($dataFile, "FTPInfo", "username", "Not Found")
$pass = IniRead($dataFile, "FTPInfo", "pass", "Not Found")
$Bestand = IniRead($dataFile, "FTPInfo", "Bestand", "Not Found")
$Path = IniRead($dataFile, "FTPInfo", "Path", "Not Found")

Then you can run your connection.

Edited by sleepydvdr

#include <ByteMe.au3>

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