Simple FTP upload with PHP
2015-06-19
How to to upload a file to a FTP Server using PHP. There are several ways to accomplish this.
Using file_put_contents()
command.
// FTP access data
$sUser = 'developer';
$sPassword = 'secret';
$sHost = 'ftp.example.com';
// file informations
$sFilename = 'file.txt';
$sContent = 'Example Content. DateTime: ' . date('Y-m-d H:i:s');
// save the file
$bSuccess = (boolean) file_put_contents(
// target FTP fi […]
jquery: ajax example
2015-03-22
this is a simple code example to remember how it works, to show how the structure looks like.
$.ajax({
url: 'Controller.php',
type: 'post',
data: oFormData,
contentType: false,
processData: false,
dataType: 'json',
statusCode: {
404: function() {
console.log("404 page not found");
}
},
success: function(oResponse, status, xhr){
console.log('success oResponse', oResponse […]