SendHTTPFile ( iHTTP, szServerFile, szPostData, szLocalFile )
from the AppGameKit help
`I'm posting the AGK code and PHP script required to make this work
`There is no need to have an html form associated with this.
`Just uploadfile.php and the AGK code.
`You must have a directory named "upload" in your server's root folder.
`Mine on my XAMPP sever is "C:\XAMPP\htdocs\upload"
`The file you are sending from the AGK code must be in your media directory
// BEGIN AGK CODE
fileID = OpenToWrite("test.txt" , 0)
WriteLine(fileID , "this is a test")
CloseFile(fileID)
cid = CreateHTTPConnection()
SetHTTPHost(cid, "1.1.1.1" , 0) // <-- MAKE SURE TO REPLACE "1.1.1.1" WITH YOUR SERVER'S ACTUAL IP
SendHTTPFile(cid , "uploadfile.php" , "" , "test.txt")
SetPrintSize(1)
repeat
if GetHTTPResponseReady( cid ) = 1
print (GetHTTPResponse( cid ))
else
print ( GetHTTPFileProgress( cid ))
endif
Sync()
until done = 1
CloseHTTPConnection(cid)
DeleteHTTPConnection(cid)
END
// END AGK CODE
// BEGIN PHP SCRIPT
// It is probably a good idea to do some research and add some security
// to this script as it will pretty much accept anything!
// It is important to use "myfile" as that is the index name AGK uses
// when calling SendHTTPFile()
<?PHP
if ($_FILES["myfile"]["error"] > 0){
echo "Error: " . $_FILES["myfile"]["error"] . "\n";
}
else {
echo "Upload: " . $_FILES["myfile"]["name"] . "\n";
echo "Type: " . $_FILES["myfile"]["type"] . "\n";
echo "Size: " . ($_FILES["myfile"]["size"] / 1024) . " Kb\n";
echo "Stored in: " . $_FILES["myfile"]["tmp_name"] . " \n";
if (file_exists("upload/" . $_FILES["myfile"]["name"]))
{
echo $_FILES["myfile"]["name"] . " already exists. \n\n";
}
else
{
move_uploaded_file($_FILES["myfile"]["tmp_name"], "upload/" . $_FILES["myfile"]["name"]);
echo "Stored in: " . "upload/" . $_FILES["myfile"]["name"] . " \n\n";
}
}
?>
// END PHP SCRIPT
fubar