Jump to content


file type not recognised

  • Please log in to reply
No replies to this topic

#1 jameschambers

  • New Members
  • Pip
  • Newbie
  • 8 posts

Posted 22 June 2006 - 10:11 AM

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
'invalid video format: video/x-mpeg'
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

<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">

from video_submit.php

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.

0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users