File upload size limit

I am investigating the problem of downloading files using html5, and I have a theoretical question: does html5 have any restrictions on the file size for downloading? For example, is it possible to upload ~ 500 GB files?

PS: I use FileReader api to read the file.

Ok This issue has been resolved.

But as explained in the FileReader API:

This interface provides methods for reading File or Blob objects in memory ...

As I understand correctly, I can’t read a file with a size that is larger than the available RAM?

+4
source share
2 answers

No, there is no limit to download size.

, , , , .

, , / . . php/wordpress

+5

, .

, script :

<form action="check.php" method="post" enctype="multipart/form-data">
<label>Upload An Image</label>
<input type="file" id="file_upload" name="file_upload" />
<input type="submit" onClick="return validate()" name="upload"/>
</form>

<script>
function validate(){
var size=2097152;
var file_size=document.getElementById('file_upload').files[0].size;
if(file_size>=size){
    alert('File too large');
    return false;
}
var type='image/jpeg';
var file_type=document.getElementById('file_upload').files[0].type;
if(file_type!=type){
    alert('Format not supported,Only .jpeg images are accepted');
    return false;
}
}

php :

 <?php 
        if(isset($_POST['upload'])){

                $target_dir = "uploads/";
                $target_file = $target_dir . basename($_FILES["file_upload"]["name"]);
                if(move_uploaded_file($_FILES["file_upload"]["tmp_name"], $target_file)){ 
                echo "The file ". basename( $_FILES["file_upload"]["name"]). " has been uploaded.";
                }
                else{
                    echo "sorry";
                    }

        }
    ?>
0

All Articles