🔒 Closed PHP CODE HELP

Status
Not open for further replies.

Spaghetto

Honorary Poster
Pa help po di po gumagana yung file size restriction ko kapa masyadong malaki yung size
ito po yung lumalabas ito po ay galing sa local host server pero pag jpg tapos lagpas 1mb ok naman pero kapag mp4 namalaki masyado ayaw gumana ng error handler
Warning: POST Content-Length of 641609433 bytes exceeds the limit of 41943040 bytes in Unknown on line 0


Code:
<?php
    session_start();
    include_once 'db.php';
    $id = $_SESSION['id'];

    if (isset($_POST['submit'])) {
        $files = $_FILES['file'];

        $name = $_FILES['file']['name'];
        $tmp = $_FILES['file']['tmp_name'];
        $size = $_FILES['file']['size'];
        $error = $_FILES['file']['error'];

       
        $fileExt = explode('.', $name);
        $ActualExt = strtolower(end($fileExt));
        $allowed = array('jpg', 'jpeg', 'png');
        if (in_array($ActualExt, $allowed)) {
            if($error === 0){
                if($size < 1000000){
                    $newName = 'avatar'.$id.".jpg";
                    $dest = "uploads/".$newName;
                    move_uploaded_file($tmp, $dest);
                    $sql = "update profile set status= 0 where userid='$id';";
                    mysqli_query($link, $sql);
                    header("location: Welcome.php");
                } else{
                    echo "You file is too big.";
                }
            } else{
                echo "You have an error upload the file.";
            }
        } else{
            echo "You cannot Upload a file in that extension.";
        }

    }
 
bat hindi mo nalang gawing client side yung pag check ng file size?


pag nag upload ka ng vid need muna ma upload lahat sa server tsaka magaganap yung validation

ang error naman na nang yari di pa na start validation kasi uploading pa and na hit na max size kaya nag error

ang gawin mo change mo post size sa php.ini or .htaccess

search mo nalang sa google
 
Status
Not open for further replies.

Similar threads

About this Thread

  • 2
    Replies
  • 380
    Views
  • 3
    Participants
Last reply from:
dev-ace

Trending Topics

Online now

Members online
1,093
Guests online
2,969
Total visitors
4,062

Forum statistics

Threads
2,307,787
Posts
29,181,110
Members
1,192,615
Latest member
newsimp1234
Back
Top