Simple FTP upload with PHP
2015-06-19
IN1, 2015-06-19 00:00:00
IN1, 2023-04-10 14:16:28


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
IN1, 2015-03-22 00:00:00
IN1, 2023-04-10 14:16:28


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 […]


This website uses Cookies to provide you with the best possible service. Please see our Privacy Policy for more information. Click the check box below to accept cookies. Then confirm with a click on "Save".