Sign in to follow this  
Followers 0
vimponia

FTP ini file

2 posts in this topic

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

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

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>

Share this post


Link to post
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
Sign in to follow this  
Followers 0