Note that there are some explanatory texts on larger screens.

plurals
  1. POUpload large files to FTP with PHP
    primarykey
    data
    text
    <p>I'm trying to upload large files with php to an ftp server. I can upload small files, but I'm having trouble uploading larger files. I have looked it up and found that I need to set upload_max_filesize and post_max_size, set ftp to passive mode, and set time limit to never. I had no luck with setting the time limit, and what I have now isn't returning any errors, but it is also not uploading the file. If you look at the <code>if (!$upload) {</code> line at the bottom, it should echo something, but it isn't. More importantly, it just isn't working. Any insight as to what is going wrong or what I need to do to make this work? Thank you!</p> <pre><code>ini_set('upload_max_filesize', '50M'); ini_set('post_max_size', '50M'); $conn_id = ftp_connect($ftp_server); // login with username and password $login_result = ftp_login($conn_id, $ftp_user_name, $ftp_user_pass); // check connection if ((!$conn_id) || (!$login_result)) { echo "FTP connection has failed!"; echo "Attempted to connect to $ftp_server for user $ftp_user_name"; exit; } // turn passive mode on ftp_pasv($conn_id, true); if($_FILES['upload_file']['name']!=''){ $source_file = $_FILES['upload_file']['tmp_name']; $destination_file = $_FILES['upload_file']['name']; // upload the file $upload = ftp_put($conn_id, $destination_file, $source_file, FTP_BINARY); // check upload status if (!$upload) { echo "FTP upload has failed!&lt;br /&gt;"; } else { echo "Uploaded $source_file to $ftp_server as $destination_file&lt;br /&gt;"; } } </code></pre> <h2>UPDATE</h2> <p>I've discovered that I cannot set the upload_max_filesize value from the php page; also, I can't seem to get .htaccess to work: if I have an .htaccess file it results in a HTTP Error 500. Also, I don't have access to php.ini.</p> <p>How else can I change the upload_max_filesize value?</p> <h2>More Information</h2> <p>My web administrator has told me that I am on an IIS windows-based system, so .htaccess files won't work. Is there a way that I can affect the file upload size with web.config?</p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload