Archived Forum Post

Index of archived forum posts

Question:

Fileupload via FTP: no files uploaded

Sep 26 '12 at 11:59

For some reason i am not able to upload a file from my c: drive to the ftp-server (my NAS).

    //  Change to the remote directory where the file will be uploaded.
$success = $ftp->ChangeRemoteDir('/Web/ftpdata/');
if ($success != true) {
    print $ftp->lastErrorText() . "\n";
    exit;
}

//  Upload a file.
$localFilename = 'c:/test.ico';
$remoteFilename = 'test.ico';

$success = $ftp->PutFile($localFilename,$remoteFilename);
if ($success != true) {
    print $ftp->lastErrorText() . "\n";
    exit;
}

See attached message:

Blockquote ChilkatLog: PutFile: DllDate: Aug 9 2012 UnlockPrefix: Anything for 30-day trial Username: MY-NAS: Architecture: Little Endian; 32-bit Language: Linux PHP VerboseLogging: 0 LocalFilename: c:/test.ico RemoteFilename: test.ico hcCurDate: Wed, 26 Sep 2012 12:15:43 +0200 hcExpire: 11/2012 IdleTimeoutMs: 60000 ReceiveTimeoutMs: 60000 ConnectTimeoutSeconds: 60 Failed to get local file size. localFilePath: c:/test.ico --PutFile TotalTime: Elapsed time: 0 millisec Failed. --ChilkatLog


Answer

The LastErrorText indicates you're running on Linux, but you're passing a local file path starting with "C:/" ?


Answer

So i have got it the wrong way i guess...wanted the user to visit our website and use a php-script to let him upload a file (from his hdd) to our ftp-server.

Looks like i have to write an application in e.g. c++ and give it to the customers. Webbased would be so much smarter ;)


Answer

Your PHP script runs on the server, not on the client where the web browser is running.


Answer

Thank you for clarification.

Do you provide any example on how to upload files to a webserver which does not support ASP.NET but PHP with Chilkatlib?


Answer

You cannot use Chilkat from within a browser. You would never want to try using the FTP protocol from the client-side -- it would be fraught with problems -- namely firewalls, anti-virus, client-side software firewalls, etc.

HTTP uploads are accomplished via HTML or Javascript. I cannot help more with this because the Internet is abundant with resources, examples, and information regarding the topic..