Well just uploaded exe file mp3 file and video file all at once using the following script
Code: Select all
<?php include('functions.php'); ?>
<?php
if(isset($_POST['submit'])){
$numfilesuploaded = $_POST['numuploads'];
$count = 1;
while ($count <= $numfilesuploaded)
{
$conname = "new_file".$count;
$filetype = $_FILES[$conname]['type'];
$filename = $_FILES[$conname]['name'];
if ($filename != '')
{
if ($filetype == "image/JPEG" || "image/jpeg" || "image/JPG" || "image/jpg" || "image/pjpeg" || "image/pjpg")
{
$maxfilesize = $_POST['maxsize'];
$filesize = $_FILES[$conname]['size'];
if($filesize <= $maxfilesize )
{
$randomdigit = rand(0000,9999);
$newfilename = $randomdigit.$filename;
$source = $_FILES[$conname]['tmp_name'];
$target = "adpics/".$newfilename;
move_uploaded_file($source, $target);
$key = $_GET['key'];
require_once('conf.php');
$connection = mysql_connect($host, $user, $pass) or die ('Unable to connect!');
mysql_select_db($db) or die ('Unable to select database!');
$query = mysql_query("INSERT INTO padpics (`rkey`, `file`) VALUES ('$key', '$newfilename')");
echo $filetype;
}
else
{
echo $count." File is too big! 10MB limit! |";
}
}
else
{
echo " The file is not a supported type |";
}
}
$count = $count + 1;
}
}
?>
<html>
<?php
$numuploads = 10;
$count = 1;
?>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<meta name="description" content="Free Classified UK and Ireland, B&B Directory, Business classified, private classified, Advertise here for free">
<meta name="keywords" content="Free, Classified, Business, directory, private, cars, property, office, car parts, boats, car accesories, vans, services, it, jobs, bed and breakfast, hotels, stuff for sale, free, local businesses, local, property, activities, hobbies, pets, lost and found, skills, ride, share, office, equipment, photo, video, catering, printing, transportation, moving, electrical, furniture, cv, post, ad, advert, advertise, webdesign, networking">
<title>AdsList.co.uk Free Classified and Business directory</title>
<style type="text/css">
<!--
body {
margin-left: 0px;
margin-top: 0px;
margin-right: 0px;
margin-bottom: 0px;
}
a:link {
text-decoration: underline;
color: #000000;
}
a:visited {
text-decoration: underline;
color: #000000;
}
a:hover {
text-decoration: none;
color: #000000;
}
a:active {
text-decoration: underline;
color: #000000;
}
body,td,th {
font-family: Arial, Helvetica, sans-serif;
}
.style3 {font-size: x-small}
.style4 {font-size: small}
.style6 {color: #FFFFFF}
.style8 {
color: #329900;
font-weight: bold;
}
.style9 {color: #2C55B1; font-weight: bold; }
.style13 {font-size: x-small; color: #000000; }
.style14 {
color: #FF0000;
font-weight: bold;
font-size: large;
}
-->
</style>
<script src="Scripts/AC_RunActiveContent.js" type="text/javascript"></script>
</head>
<body onLoad="MM_preloadImages('navigbuttons/home2.gif','navigbuttons/business2.gif','navigbuttons/private2.gif','navigbuttons/advert2.gif','navigbuttons/faq2.gif','navigbuttons/contacts2.gif')">
<table width="100%" border="0" cellpadding="0" cellspacing="0">
<!--DWLayoutTable-->
<tr>
<td colspan="3" rowspan="2" valign="top" background="images/searchback.gif"><img src="images/logo.jpg" width="255" height="201"></td>
<td height="57" colspan="4" align="right" valign="bottom" class="style4"><span class="style6"><a href="plogin.php"><a href="blogin.php"></a></span><a href="plogin.php"><a href="blogin.php"><a href="register1.php">Register/Advertise</a><span class="style6"><a href="plogin.php"><a href="blogin.php"> Business Login</a> <a href="#">Personal Login</a></span></td>
</tr>
<tr>
<td height="144" colspan="3" align="center" valign="middle" background="images/searchback.gif"><?php include('search.php'); ?> </td>
<td width="130" align="center" valign="bottom" background="images/searchback.gif"><p><span class="style4"><span class="style6"><br>
</span><br>
</span></p>
<p> </p></td>
</tr>
<tr>
<td width="154" rowspan="3" align="center" valign="top" bgcolor="#2C55B1"><br>
<table width="100" border="0" cellspacing="0" cellpadding="0">
<tr>
<td><p>
<?php include('links.php'); ?>
</p></td>
</tr>
</table>
<p> </p></td>
<td height="19" colspan="4" valign="top"><div align="center" class="style14"></div></td>
<td colspan="2" rowspan="3" valign="top" bgcolor="#2C55B1"><!--DWLayoutEmptyCell--> </td>
</tr>
<tr>
<td width="17" height="397" valign="top"><!--DWLayoutEmptyCell--> </td>
<td colspan="2" align="left" valign="top"><p>Add photos of your item to the listing?</p>
<p><form action="<?php echo $_server['php-self']; ?>" method="post" enctype="multipart/form-data" id="something" class="uniForm">
<?php
while ($count <= $numuploads)
{
?>
<input name="new_file<?php echo $count; ?>" id="new_file<?php echo $count; ?>" size="30" type="file" class="fileUpload" /><br>
<?php
$count = $count + 1;
}
?>
<input type = "hidden" name="maxsize" value = "8388608">
<input type = "hidden" name="numuploads" value = "<?php echo $numuploads; ?>">
<br>
<button name="submit" type="submit" class="submitButton">Upload Files</button>
</form> </p></td>
<td width="18" valign="top"><!--DWLayoutEmptyCell--> </td>
</tr>
<tr>
<td height="19" colspan="4" valign="top"><!--DWLayoutEmptyCell--> </td>
</tr>
<tr background="images/weeback.gif">
<td height="39" colspan="7" align="center" valign="top" background="/images/weeback.gif"><span class="style3"><a href="/">Home</a> <a href="contacts.php">Contact Us</a> <a href="faq.php">FAQ</a> <a href="register1.php">Register</a> <a href="register1.php">My Ads</a></span> <a href="about.php"><span class="style3">About us </span></a><br>
<span class="style3">©2007</span></td>
</tr>
<tr><td height="1"><img src="spacer.gif" alt="" width="154" height="1"></td><td><img src="spacer.gif" alt="" width="17" height="1"></td>
<td width="84"><img src="spacer.gif" alt="" width="84" height="1"></td>
<td width="100%"></td>
<td><img src="spacer.gif" alt="" width="18" height="1"></td>
<td width="22"><img src="spacer.gif" alt="" width="22" height="1"></td>
<td><img src="spacer.gif" alt="" width="130" height="1"></td></tr>
</table>
</body>
</html>
all files were uploaded and added to database, maybe i am missing something i do not know plz help