Jump to content

Recommended Posts

Hello i m trying to  upload video files using AMPPS server with php 5.6 in it but when i uploads it gives me an error report in file that i uploading , and when i uploads an image file it upload with no error so i don't understand why it doesn't uploading videos/audios .

 

please help if you have an clue in this thing

Edited by FrankGalos
Link to comment
https://forums.phpfreaks.com/topic/297792-mpeg-files-uploading-php-5-6-support/
Share on other sites

<?php

    if(isset($_POST['submit'])){
        echo $file = $_FILES['vm']['name'];
        $type = $_FILES['vm']['type'];
        $size = $_FILES['vm']['size'];
        echo $error= $_FILES['vm']['error'];
        $file_loc = $_FILES['vm']['tmp_name'];

        $path = 'uploads/';

        if(!empty($file)){
            if(preg_match('/\.(mp4|webm|ogg|mp3|jpg)$/i',$file)){
                if($error === 0){
                if(move_uploaded_file($file_loc,$path.$file)){
                echo 'uploading successfuly';
                }else{
                    echo 'upload failed';
                    die();
                }

            }else{
                echo('error in file');
            }
            }
        }else{
            echo 'file can not be empty';
            die();
        }
    }
?>

<form action="filehandler.php" method="post" enctype='multipart/form-data'>

    file<input type = 'file' name='vm' ><input type="submit" name="submit" value="submit">
</form>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.