[PLUG] Problem in ftp file upload using php script on twisted server.
Kapil Agrawal
kapil.agl at gmail.com
Wed Apr 14 15:14:48 IST 2010
Hi all,
I need some help in uploading large files to twisted server.
I want to upload large files on twisted server using http..But as http has
limit of 24MB, I decided to use ftp functions of php to upload large files.I
am running ftp server written in twisted.When i try to upload a file using
any ftp client then its working fine but when i use a php script for ftp
file upload then it is not working.Initially when i tried to upload file
using same php script but without passive mode , it created a file on server
but the size of file was 0 bytes.When i added a line to switch to passive
mode now it doesn't go beyond a function to switch passive mode and
connection to server gets timed out.Here is my php code
<?php
> $ftp_server='localhost';
> $ftp_user_name='chetan';
> $ftp_user_pass='chetan';
> $file = 'av.jpg';
> $remote_file = 'av.jpg';
>
> $conn_id = ftp_connect($ftp_server, 8002);
>
> $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass);
>
> ftp_pasv($conn_id, true);
>
> if (ftp_put($conn_id, $remote_file, $file, FTP_BINARY)) {
> echo "successfully uploaded $file\n";
> } else {
> echo "There was a problem while uploading $file\n";
> }
>
> ftp_close($conn_id);
> ?>
>
>
Or is there any other way i can upload large files on twisted server ?
Regards
Kapil
--
http://www.linkedin.com/in/kapilagrawal
More information about the Plug-mail
mailing list