try this create folder called upload_files and upload the zip files to it
upload.php
<?php
// ==============
// Configuration
// ==============
ob_start();
session_start();
if(!isset($_COOKIE["id"]))
{
header("Location: register.php");
}
else
{
include("header.php");
//Categories
$catresult = mysql_query("SELECT * FROM pp_categories WHERE disable='0'") or die("Error: " . mysql_error());
//Gets Categories
while ($catrow2 = mysql_fetch_array($catresult)){
$result11[] = $catrow2;
}
//pass the results to the template
$smarty->assign('cat', $result11);
$dossier = 'upload_files/';
$fichier = basename($_FILES['file']['name']);
$taille_maxi = 750000000;
$taille = filesize($_FILES['file']['tmp_name']);
$extensions = array('.png', '.gif', '.jpg', '.jpeg','.mov', '.swf', '.wmv', '.mpg','.mp3');
$extension = strrchr($_FILES['file']['name'], '.');
$max_height = "1000"; // This is in pixels - Leave this field empty if you don't want to upload images
$max_width = "1000"; // This is in pixels - Leave this field empty if you don't want to upload images
//Scurtiy test
if(!in_array($extension, $extensions)) //Extension test
{
$erreur = 'Only png, gif, jpg, jpeg, mov, flv, wmv; swf, mp3 files are allowed';
}
if($taille>$taille_maxi)
{
$erreur = 'The file is too big';
}
$filesize = $_FILES['file']['size'];
$filename = $_FILES['file']['name'];
// Check Height & Width
if(!empty($_FILES['file']['tmp_name']));
{
if ($max_width && $max_height) {
list($width, $height, $type, $w) = getimagesize($_FILES['file']['tmp_name']);
if($width > $max_width || $height > $max_height)
{
Print "File height and/or width are too big!";
exit;
}
}
}
if(!isset($erreur)) //S'il n'y a pas d'erreur, on upload
{
list($width, $height, $type, $w) =getimagesize($_FILES['file']['tmp_name']);
$fichier = basename($_FILES['file']['name']);
if(move_uploaded_file($_FILES['file']['tmp_name'], $dossier . $fichier)) //Si la fonction renvoie TRUE, c'est que ça a fonctionné...
{
$erreur ='Congratulation, your file '.$fichier.' '.$width.'X'.$height.' has been uploaded on our server !';
if(($extension == '.gif') OR ($extension == '.png') OR ($extension == '.jpg') OR ($extension == '.jpeg'))
{
$picture = 'upload_files/'.$fichier.'';
}
elseif($extension == '.wmv')
{
$picture = 'upload_files/wmv.jpg';
}
elseif($extension == '.mov')
{
$picture = 'upload_files/mov.jpg';
}
else
{
$picture ='no_picture.jpg';
}
mysql_query("INSERT INTO pp_files (name, video_type, creator, description, date, file, file2, approved, picture, category)
VALUES ('$_POST[name]', '$extension' , '$_COOKIE[user]', '".safe_sql_insert($_POST['description'])."', CURRENT_DATE(),'$fichier','$w','0','$picture', '$_POST[category]')") or die(mysql_error());
}
else //Sinon (la fonction renvoie FALSE).
{
$erreur = 'Upload failed !';
}
}
}
$smarty->assign('message', $erreur);
$smarty->display('upload.tpl');
?>
upload.tbl
{include file="header.tpl"}
{literal}
<script>
function checkform()
{
if (document.video.name.value == '') {
alert('Please Enter A Title');
return false;
}
else if (document.video.description.value == '')
{
alert('Please Enter A description');
return false;
}
}
// If the script gets this far through all of your fields
// without problems, it's ok and you can submit the form
return true;
}
</script>
{/literal}
<br />
<div align="center">
<font size="4" face="Times">
{$message}<br><br><br></font>
<form action="upload.php" method="post" name="video" onSubmit="return checkform()" ENCTYPE="multipart/form-data">
<!--Center Page-->
<h3><font size="5" face="Times"><b>Submit you video</b>:{$source}</font></h3>
<table width="83" border="0">
<tr>
<td height="21" align="center"><b>Name</b></td>
</tr>
<tr>
<td height="21" align="center"><textarea name="name" cols="50" rows="1" id="name" style="text-align:center; text-shadow:#990000"></textarea></td>
<td> </td>
</tr>
<tr>
<td height="21" align="center"><b>Description</b></td>
</tr>
<tr>
<td height="104"><textarea name="description" cols="50" rows="6" style="text-align:center;"></textarea></td>
<td> </td>
</tr>
<tr>
<td height="21" align="center"><b>File</b></td>
</tr>
<tr>
<td height="104"><input type="file" name="file" size="30"></td>
<td> </td>
</tr>
<tr>
<td height="19" align="center"><b>Category</b></td>
</tr>
<tr>
<td height="104" align="center"><select name="category" size="6">
{section name=cat loop=$cat}
<option value="{$cat[cat].id}" {if $cat[cat].id eq "1"}selected="selected"{/if}>{$cat[cat].name}</option>
{/section}
</select>
</td>
<td> </td>
</tr>
</table>
<p align="center">
<input type="submit" value="Submit">
</p>
</form>
</div>
{include file="footer.tpl"}
players.tbl
{if $vidtype eq "YouTube"}
<object type="application/x-shockwave-flash" style="width:450px; height:366px;" data="http://www.youtube.com/v/{if $video[video].file eq ""}{$videoid}{else}{$video[video].file}{/if}&autoplay=1">
<param name="movie" value="http://www.youtube.com/v/{if $video[video].file eq ""}{$videoid}{else}{$video[video].file}{/if}&autoplay=1" />
</object>
{elseif $vidtype eq "GoogleVideo"}
<embed style="width:400px; height:326px;" id="VideoPlayback" type="application/x-shockwave-flash" src="http://video.google.com/googleplayer.swf?docId={if $video[video].file eq ""}{$videoid}{else}{$video[video].file}{/if}" flashvars=""> </embed>
{elseif $vidtype eq "dailymotion"}
<div><object width="425" height="335"><param name="movie" value="http://www.dailymotion.com/swf/{if $video[video].file eq ""}{$videoid}{else}{$video[video].file}{/if}"></param><param name="allowfullscreen" value="true"></param><embed src="http://www.dailymotion.com/swf/{if $video[video].file eq ""}{$videoid}{else}{$video[video].file}{/if}" type="application/x-shockwave-flash" width="425" height="334" allowfullscreen="true"></embed></object></div>
{elseif $vidtype eq ".swf"}
<!--div><object {$video[video].file2}>
<param name="movie" value="upload_files/{$video[video].file}"></param><param name="allowfullscreen" value="true"></param>
<embed src="upload_files/{$video[video].file}" type="application/x-shockwave-flash" {$video[video].file2} allowfullscreen="true"></embed></object></div-->
<!--div id="player" style="display:block;width:425px;height:300px;"></div>
<script>
flowplayer("player", "upload_files/{$video[video].file}", ...);
</script-->
<!--link rel="stylesheet" type="text/css" href="css/style.css"-->
<a
href="upload_files/{$video[video].file}"
style="display:block;width:520px;height:330px"
id="player">
</a>
<!-- this will install flowplayer inside previous A- tag. -->
<script>
flowplayer("player", "upload_files/{$video[video].file}");
</script>
<div id="flashbanner">this will be replaced by the SWF.</div>
<script type="text/javascript">
var so = new SWFObject('upload_files/{$video[video].file}','mpl','400','450','9');
so.addParam('allowfullscreen','true');
so.addParam("quality", "low");
so.addParam("wmode", "transparent");
so.addParam("salign", "t");
so. addParam('flashvars','file=playlist.xml&autostart=true');
so.write('flashbanner');
</script>
{elseif $vidtype eq ".gif"}
<img src="upload_files/{$video[video].file}" {$video[video].file2}>
{elseif $vidtype eq ".png"}
<img src="upload_files/{$video[video].file}" {$video[video].file2}>
{elseif $vidtype eq ".jpg"}
<img src="upload_files/{$video[video].file}" {$video[video].file2}>
{elseif $vidtype eq ".jpeg"}
<img src="upload_files/{$video[video].file}" {$video[video].file2}>
{elseif $vidtype eq ".wmv"}
<!--object id="MediaPlayer" {$video[video].file2} classid="CLSID:22D6f312-B0F6-11D0-94AB-0080C74C7E95" standby="Loading Windows Media Player components..." type="application/x-oleobject" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=6,4,7,1112">
<param name="filename" value="upload_files/{$video[video].file}">
<param name="Showcontrols" value="True">
<param name="autoStart" value="True">
<embed type="application/x-mplayer2" src="http://media.pmcmovies.com/SixtiesLove.wmv" name="MediaPlayer"{$video[video].file2} ></embed>
</object-->
<!--OBJECT id="VIDEO" CLASSID="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" type="application/x-oleobject" width="320" height="240">
<PARAM NAME="URL" VALUE="upload_files/{$video[video].file}">
<PARAM NAME="enabled" VALUE="True">
<PARAM NAME="AutoStart" VALUE="False">
<PARAM name="PlayCount" value="3">
<PARAM name="Volume" value="50">
<PARAM NAME="balance" VALUE="0">
<PARAM NAME="Rate" VALUE="1.0">
<PARAM NAME="Mute" VALUE="False">
<PARAM NAME="fullScreen" VALUE="False">
<PARAM name="uiMode" value="full">
</OBJECT-->
<OBJECT ID="Video" width="405" height="450"
classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
type="application/x-oleobject" VIEWASTEXT>
<PARAM NAME="FileName" VALUE="upload_files/{$video[video].file}">
<PARAM NAME="ShowControls" VALUE="True">
<PARAM NAME="ShowStatusBar" VALUE="True">
<PARAM NAME="TransparentAtStart" Value="True">
<PARAM NAME="AutoStart" Value="False">
<PARAM NAME="AnimationatStart" Value="True">
<PARAM NAME="autoSize" Value="True">
<PARAM NAME="displaySize" Value="True">
<PARAM NAME="enableContextMenu" Value="True">
<PARAM NAME="Mute" VALUE="True">
<PARAM NAME="SetFullScreen" Value="True">
<PARAM NAME="uiMode" Value="invisible">
<EMBED type="application/x-mplayer2"
pluginspage = "http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/"
SRC="upload_files/{$video[video].file}"
Name="MediaPlayer1"
Width="405"
Height="450"
autoStart=1
transparentAtStart=1
animationAtStart=1
autoSize=1
ShowStatusBar=1
ShowControls=1
displaySize=1
SetFullScreen=1
Mute=1
enableContextMenu=1
uiMode="invisible"
align="center">
</EMBED>
</OBJECT>
<!--SELECT name=selecta size=1 id=musica onchange=document.all.playera.Filename=document.all.musica.value;>
<OPTION selected>::::::::: Choose Your Media Sample Here :::::::::</OPTION>
<OPTION value="upload_files/{$video[video].file}">My Video File </OPTION>
<OPTION value="Stream URL or Full File Path Goes Here">My Audio File</OPTION>
<OPTION value="Stream URL or Full File Path Goes Here">My Live Stream</OPTION>
</select-->
<BR>
<!--OBJECT id=playera height=430 width=430 classid=clsid:22D6F312-B0F6-11D0-94AB-0080C74C7E95>
<PARAM NAME="AutoStart" VALUE="True">
<PARAM NAME="Balance" VALUE="True">
<PARAM NAME="DisplaySize" VALUE="True">
<PARAM NAME="Filename" VALUE="upload_files/{$video[video].file}">
<PARAM NAME="Mute" VALUE="True">
<PARAM NAME="SelectionStart" VALUE="True">
<PARAM NAME="SelectionEnd" VALUE="True">
<PARAM NAME="ShowControls" VALUE="True">
<PARAM NAME="ShowAudioControls" VALUE="True">
<PARAM NAME="ShowDisplay" VALUE="True">
<PARAM NAME="ShowPositionControls" VALUE="True">
<PARAM NAME="Volume" VALUE="1">
<PARAM NAME="AudioStream" VALUE="False">
<PARAM NAME="AutoSize" VALUE="True">
<PARAM NAME="AnimationAtStart" VALUE="True">
<PARAM NAME="AllowScan" VALUE="False">
<PARAM NAME="AllowChangeDisplaySize" VALUE="True">
<PARAM NAME="AutoRewind" VALUE="True">
<PARAM NAME="BaseURL" VALUE="">
<PARAM NAME="BufferingTime" VALUE="5">
<PARAM NAME="CaptioningID" VALUE="">
<PARAM NAME="ClickToPlay" VALUE="True">
<PARAM NAME="CursorType" VALUE="0">
<PARAM NAME="CurrentPosition" VALUE="True">
<PARAM NAME="CurrentMarker" VALUE="True">
<PARAM NAME="DefaultFrame" VALUE="mainframe">
<PARAM NAME="DisplayBackColor" VALUE="True">
<PARAM NAME="DisplayForeColor" VALUE="16777215">
<PARAM NAME="DisplayMode" VALUE="1">
<PARAM NAME="Enabled" VALUE="-1">
<PARAM NAME="EnableContextMenu" VALUE="True">
<PARAM NAME="EnablePositionControls" VALUE="True">
<PARAM NAME="EnableFullScreenControls" VALUE="True">
<PARAM NAME="EnableTracker" VALUE="False">
<PARAM NAME="InvokeURLs" VALUE="False">
<PARAM NAME="Language" VALUE="False">
<PARAM NAME="PlayCount" VALUE="1">
<PARAM NAME="PreviewMode" VALUE="True">
<PARAM NAME="ShowStatusBar" VALUE="True">
<PARAM NAME="TransparentAtStart" VALUE="True">
</OBJECT-->
{elseif $vidtype eq ".Mp3"}
<embed src= "http://www.odeo.com/flash/audio_player_standard_gray.swf" quality="high" width="300" height="52" allowScriptAccess="always" wmode="transparent" type="application/x-shockwave-flash" flashvars= "valid_sample_rate=true&external_url=upload_files/{$video[video].file}" pluginspage="http://www.macromedia.com/go/getflashplayer"> </embed>
<br><br><br>
<embed src="upload_files/{$video[video].file}"
width="140" height="40" autostart="false" loop="FALSE">
</embed>
{elseif $vidtype eq ".wav"}
<embed src= "http://www.odeo.com/flash/audio_player_standard_gray.swf" quality="high" width="300" height="52" allowScriptAccess="always" wmode="transparent" type="application/x-shockwave-flash" flashvars= "valid_sample_rate=true&external_url=upload_files/{$video[video].file}" pluginspage="http://www.macromedia.com/go/getflashplayer"> </embed>
<br><br><br>
<embed src="upload_files/{$video[video].file}"
width="140" height="40" autostart="false" loop="FALSE">
</embed>
<!--{elseif $vidtype eq ".swf"}
<object width="Width in Pixels" height="Height in Pixels" classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=7,0,19,0">
<param name="salign" value="lt">
<param name="quality" value="high">
<param name="scale" value="noscale">
<param name="wmode" value="transparent">
<param name="movie" value="http://geekfile.googlepages.com/flvplay.swf">
<param name="FlashVars" value="&streamName=upload_files/{$video[video].file}&skinName=http://geekfile.googlepages.com/flvskin&autoPlay=true&autoRewind=true">
<embed width="Width in Pixels" height="Height in Pixels" flashvars="&streamName=upload_files/{$video[video].file}&autoPlay=true&autoRewind=true&skinName=http://geekfile.googlepages.com/flvskin" quality="high" scale="noscale" salign="LT" type="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer" src="http://geekfile.googlepages.com/flvplay.swf" wmode="transparent">
</embed></object-->
{elseif $vidtype eq ".mov"}
<EMBED SRC="upload_files/{$video[video].file}" WIDTH="400" HEIGHT="440"
QTNEXT1="</quicktime/movies/sample.mov> T<myself>"
QTNEXT2="<rtsp://www.apple.com/quicktime/movies/sample.mov> T<myself>"
QTNEXT3="<URL> T<myself>"
QTNEXT4="GOTO0"
{elseif $vidtype eq ".avi"}
<object
id="mediaPlayer"
classid="CLSID:22D6F312-B0F6-11D0-94AB-0080C74C7E95"
codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701"
standby="Loading Microsoft Windows Media Player components..."
type="application/x-oleobject">
<param name="fileName" value="upload_files/{$video[video].file}">
<param name="animationatStart" value="1">
<param name="transparentatStart" value="1">
<param name="autoStart" value="1">
<param name="autoSize" value="1">
<param name="showControls" value="1">
<param name="loop" value="0">
<param name="ShowDisplay" value="0">
<param name="ShowStatusBar" value="1">
<embed type="application/x-mplayer2"
pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/"
filename="upload_files/{$video[video].file}"
src="upload_files/{$video[video].file}"
name=NSPlay
showcontrols=1
showdisplay=0
showstatusbar=1>
</embed>
</object>
{else}
This video type is currently unsuppotred
{/if}
also in the header.tbl
add this about the </ul>
<li><a {if $pagetype eq "upload"}class="current"{/if} href='upload.php?pt=upload' accesskey='t'><span class='key'>{$LAN_170|default:"upload"}</span></a></li>