Jump to content


This topic is now archived and is closed to further replies.


file type not recognised

Recommended Posts

I'm trying to write a script that will rename a video uploaded into a form then move it into a folder, but it won't recognise the file type. I have been uploading a file with a .mpg extenstion to test it but all i am getting is
[b]'invalid video format: video/x-mpeg'[/b]
I looked up mpeg/mpe/mpg file formats and as far as i can tell it should be ok.

Here is the relevant code:
from video.php[/i]

<form action="video_submit.php" method="post" enctype="multipart/form-data">
<input type="file" name="video" class="upload" size="40">
<input type="submit" value="Update Project" class="updatebutton">

[i]from video_submit.php[/i]

if ( (isset($_FILES['video']['name']) &&

if (!isset($_REQUEST['story']) || $_REQUEST['story']=='')
$story = mysqli_insert_id($handle);
$type = basename($_FILES['video']['type']);

switch ($type) {
case 'mpg':
case 'mpeg':
case 'mpe': $filename = "video/$story.mpg";
$query = "update stories
set video = '$filename'
where id = $story";
$result = $handle->query($query);

case 'avi':
case 'vfw':
case 'avx': $filename = "video/$story.avi";
$query = "update stories
set picture = '$filename'
where id = $story";
$result = $handle->query($query);

default: echo 'Invalid video format: '.

Any help gratefully received.

Share this post

Link to post
Share on other sites


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.