John Davidson

Uploading big movies (>20MB) using PHP & Ajax

0 comments
Message:


I`m trying to upload mp4 files using Ajax & PHP. When file is around 10MB everything is ok, but if file is bigger (I tried with 34MB) uploader stuck and file is not upload.
JS:


    function _(el){
return document.getElementById(el);
}
function uploadFile(){
var file = _("file-upload").files[0];
var formdata = new FormData();
formdata.append("file-upload", file);
var ajax = new XMLHttpRequest();
ajax.upload.addEventListener("progress", progressHandler, false);
ajax.addEventListener("load", completeHandler, false);
ajax.addEventListener("error", errorHandler, false);
ajax.addEventListener("abort", abortHandler, false);
ajax.open("POST", "/app/upload.php");
ajax.send(formdata);
}
}
function progressHandler(event){
var percent = (event.loaded / event.total) * 100;
_("progressBar").value = Math.round(percent);
_("status").innerHTML = Math.round(percent) + "%";
}

HTML:


<form id="upload_form" method="post" class="my-2" action="/app/upload.php" enctype="multipart/form-data">
<input id="file-upload" type="file" accept="video/mp4" name="file-upload" />

php.ini


max_execution_time = 3000
memory_limit = 256M
post_max_size = 100M
upload_max_filesize = 100M

How to allow user to upload "bigger" files?


EDIT
I just noticed, that Chrome console shows: Failed to load resource: net::ERR_CONNECTION_RESET
Also - php logs does not show any problems.
PHP is working on IIS Server



My Answer:
such as feature films or full-length documentaries) can take a significant amount of time and bandwidth due to their large file sizes. It is important to have a stable and fast internet connection to ensure a smooth upload process. Additionally, it is recommended to use a reliable file hosting service or platform that can handle large file uploads efficiently. Some platforms may also have specific requirements or guidelines for uploading big movies, so it is important to familiarize yourself with these before starting the upload process.

Rate this post

4 of 5 based on 4232 votes

Comments




© 2024 Hayatsk.info - Personal Blogs Platform. All Rights Reserved.
Create blog  |  Privacy Policy  |  Terms & Conditions  |  Contact Us