When ftp files are stored in php, the file size is 0.
Source: Internet
Author: User
When uploading an ftp file through php, the file size is 0 $ user =$ _ COOKIE ['user']; $ passwd =$ _ COOKIE ['passwd']; $ current_dir = '/home/web/text'; $ conn_id = ftp_connect ("the file size is 0 when loc uploads ftp files through php.
$ User = $ _ COOKIE ['user'];
$ Passwd = $ _ COOKIE ['passwd'];
$ Current_dir = '/home/web/text ';
$ Conn_id = ftp_connect ("localhost", 21 );
$ Dir = $ _ REQUEST ['dir'];
If (@ ftp_login ($ conn_id, $ user, $ passwd ))
{
If (ftp_put ($ conn_id, "$ put_file", "$ dir", FTP_BINARY ))
{
Echo 123;
}
Else
{
Echo 234;
}
}
Why is the file displayed after being uploaded, but the file size is 0?
------ Solution --------------------
$ Where is put_file assigned?
------ Solution --------------------
Php file upload is not processed using $ _ POST ~ If this is correct, you need to upload the data over HTTP before FTP ~ Make sure that FTP is performed on the server.
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.
A Free Trial That Lets You Build Big!
Start building with 50+ products and up to 12 months usage for Elastic Compute Service