Jump to content


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


Video Uploading script

Recommended Posts

this is the main file upload.php

<p><font face="Verdana" color="#00000" size="+1"><u><b>Essexracers.com Video
<font face="Verdana">Click on 'Browse...' to select the file you wish to upload
then click on 'Upload'<br><font size="2">Note: The file upload process may take
up to 10 minutes to upload with higher file sizes, <u><b>Maximum 12 megs.</b></u></font></font><font face="Verdana" color="#00000" size="0"><br>
<font size="2">No uploading copyrighted / illegal material. Not for outside
EssexRacers.com use.<br>
By uploading your own video's, we have the right to use them / delete them
without notice.</font></font></p>
<p><font face="Verdana" size="2">Accepted formats: .wmv | .mpg | .mpeg | .avi |
.mov | .rm | .mp4 | .asf<br>Contact <a href="mailto:joe@joeyjoe.co.uk">joe@joeyjoe.co.uk</a>
if you need a different file format uploaded!</font></p>
<form enctype="multipart/form-data" action="videoupload.php" method="POST">
    <!-- MAX_FILE_SIZE must precede the file input field -->
    <input type="hidden" name="MAX_FILE_SIZE" value="30000" />
    <!-- Name of input element determines name in $_FILES array -->
    <p align="center">
    <font size="2" face="Verdana" color="#00000">Video to upload:</font>
    <input name="userfile" type="file" size="18" />
    <input type="submit" value="Upload" /> </p>
<p align="center">&nbsp;</p>[/code]

and heres the processing file

$uploaddir = '/home/essexrac/public_html/videoupload/';
$uploadfile = $uploaddir . basename($_FILES['userfile']['name']);
$vidfilename = basename($_FILES['userfile']['name']);

$goodType = array ('video/x-ms-wmv ','video/mpeg','video/x-msvideo');

if (in_array($_FILES['userfile']['type'], $goodType)) {
echo '<pre>';
if (move_uploaded_file($_FILES['userfile']['tmp_name'], $uploadfile)) {
   echo "Video uploaded to: http://www.essexraces.com/videoupload/$vidfilename\n";
} else {
   echo "There was an error uploading the video!\n";

echo 'Here is some more debugging info:';

print "</pre>";
echo "File isnt within the allowed formats!<br>";
echo "Accepted formats: .wmv | .mpg | .mpeg | .avi | .mov | .rm | .mp4 | .asf";

The file size limiter doesnt work, and also, it uploads the file taking ages before it tells u that the filesize is wrong. how can i make it do it straigt away? what do i change to make the file size limit 12 megs?

Share this post

Link to post
Share on other sites
Well, you can't know the filesize before the user actually sends it; unless you use some client-sided applet to verify it before sending.

About the file size, you must change the "upload_max_filesize" setting, which is usually 2MB
Note that this option can be set in php.ini or httpd.conf only.

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.