Why i could not upload file more than 3 mb using php at amazon ec2 server?

吃可爱长大的小学妹 提交于 2020-01-30 06:41:28

问题


I am working with Amazon EC2 server with linux instance. In my project user can upload video. So I used php to upload the file. It is working in other server but not working in amazon ec2 server. When I upload file less than 1 mb it is working but if the file size is greater than 3mb than it is not working.I don't know where to set the permission to upload large file. What can I do?

This is my sample code -

 <?php
    $fileName = $_FILES["file1"]["name"]; // The file name
    $fileTmpLoc = $_FILES["file1"]["tmp_name"]; // File in the PHP tmp folder
    $fileType = $_FILES["file1"]["type"]; // The type of file it is
    $fileSize = $_FILES["file1"]["size"]; // File size in bytes
    $fileErrorMsg = $_FILES["file1"]["error"]; // 0 for false... and 1 for true
    if (!$fileTmpLoc) { // if file not chosen
        echo "ERROR: Please browse for a file before clicking the upload button.";
        exit();
    }
    if(move_uploaded_file($fileTmpLoc, "test_uploads/$fileName")){
        echo "$fileName upload is complete";
    } else {
        echo "move_uploaded_file function failed";
    }
    ?>

回答1:


Look your php.ini file for upload_max_filesize and increase that value. If I'm not mistaken the default is 2M.



来源:https://stackoverflow.com/questions/32420627/why-i-could-not-upload-file-more-than-3-mb-using-php-at-amazon-ec2-server

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!