简体   繁体   中英

Try to upload .zip file using ftp_put function but it is not able to upload large file(more than 1 MB)

I am using the following code to upload a .zip file, but am unable to upload a file of size greater than 1MB:

$upload = ftp_put($conn_id, $target_path.'/'.$filename, $source, FTP_BINARY);

Any thoughts?

Have you changed the config settings at php.ini max_file_uploads to a latger value, the values are taken as MB so give something as large as 5

I am sure it should work.

  1. changing in php.ini will result in php application that is running.

  2. changing in htaccess file will result in project

  3. changing in a php file will result in php file and its included files

Choosing which one is based on your recuirements.

Use, upload_max_filesize this will control the size of file to be uploaded.

post_max_size is the size of data posted in side form elements.

it could be file, input, checkbox... etc. So this also has to be altered based on file size.

You should adjust both upload_max_filesize and post_max_size to perform file operation and others...

Have you checked error_log . If not check that, and find out what exactly the problem is, and if using apache, you can set the php.ini setting in .htaccess . Like this

php_value  upload_max_filesize  20M

Paste this .htaccess file and you will be able to upload the file. Also,check error_log for exactly what is causing the issue.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM