ODEAR
04-05-2008, 06:57 PM
ok well basicly, iv code'd an image uploader, and i have a template on the upload page but i cant get a template onto the uploader page.
this is the code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ooop » Free Image Hosting</title>
<style type="text/css">
<!--
body {
background-image: url(top_bar.gif);
background-repeat: repeat-x;
margin-top: 170px;
}
.test {
font-family: "myriad Pro";
font-weight: bold;
color: #244386;
}
.title {
font-size: 24px;
font-family: "myriad Pro";
color: #244386;
font-weight: bold;
letter-spacing: -1.8px;
}
.footer {
font-family: "myriad Pro";
color: #244386;
font-size: 12px;
font-weight: bold;
a:hover
}
.a:hover {
font-family: "myriad Pro";
color: #244386;
font-size: 12px;
font-weight: bold;
text-decoration: underline;
}
#logo {
position:absolute;
left:19px;
top:31px;
width:188px;
height:56px;
z-index:1;
background:logo.png;
background-image: url(logo.png);
}
-->
</style>
</head>
<body>
<div id="logo"></div>
<!-- All the kinds of code you want to be outputed go here --><?
// CONFIG
$serverpath = "images/";
$urltoimages = "http://ooop.co.uk/images";
$maxsize = "5000000";
$uniq = uniqid("");
// CONFIG END
$mode = $_GET['mode'];
if ($mode == "") { $mode = "form"; }
if ($mode == "form") {
echo "<form enctype='multipart/form-data' method='post' action='?mode=upload'>\n";
echo "Upload file: <input type='file' name='file'>\n";
echo "<br><input type='submit' name='Submit' value='Upload'>\n";
echo "<br>Maximum File Size: 5$maxsizeb MB";
echo "<br>hi im drew, and i like ponys";
echo "<br>$file";
}
if ($mode == "upload") {
$file = $_FILES['file']['name'];
$name = time() . substr($file, -4);
$allowedfiles[] = "gif";
$allowedfiles[] = "jpg";
$allowedfiles[] = "jpeg";
$allowedfiles[] = "jfef";
$allowedfiles[] = "jpe";
$allowedfiles[] = "png";
$allowedfiles[] = "GIF";
$allowedfiles[] = "JPG";
$allowedfiles[] = "JPEG";
$allowedfiles[] = "JFEF";
$allowedfiles[] = "JPE";
$allowedfiles[] = "PNG";
$allowedfiles[] = "bmp";
$allowedfiles[] = "BMP";
$allowedfiles[] = "tif";
$allowedfiles[] = "tiff";
$allowedfiles[] = "TIF";
$allowedfiles[] = "TIFF";
if($_FILES['file']['size'] > $maxsize)
{
print "File size is too big - please reduce file size and try again.";
}
else {
$path = "$serverpath/" . $name;
foreach($allowedfiles as $allowedfile) {
if ($done <> "yes") {
if (file_exists($path)) {
echo "A file with this name already exists - please rename the file and reupload.";
exit;
}
}
if (substr($file, -3) == $allowedfile) {
move_uploaded_file($_FILES['file']['tmp_name'], "$path");
$done = "yes";
echo "<p></p>";
?>
</span>
<table width="656" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3" class="title"><span class="title">
File successfully uploaded</span></td>
</tr>
<tr>
<td height="3" colspan="3"></td>
</tr>
<tr>
<td height="3" colspan="3" bgcolor="#244386"></td>
</tr>
<tr>
<td height="15" colspan="3"></td>
</tr>
<tr>
<td colspan="3"><div align="center"><span class="test"><img src="<?php echo "$urltoimages/$name"?>" /></span></div></td>
</tr>
<tr>
<td height="15" colspan="3"></td>
</tr>
<tr>
<td width="92" height="22"><span class="test">Direct Link:</span></td>
<td width="24" height="22"></td>
<td width="540"><input name='direct' type='text' align='center' size='85' value='<?php echo "$urltoimages/$name" ?>' /></td>
</tr>
<tr>
<td height="22"></td>
<td height="22"></td>
<td height="22"></td>
</tr>
<tr>
<td><span class="test">IMG Code:</span></td>
<td height="22"></td>
<td><input name='imgcode' type='text' align='center' size='85' value='<?php echo "$urltoimages/$name" ?> (http://ooop.co.uk/)' /></td>
</tr>
<tr>
<td height="22"></td>
<td height="22"></td>
<td height="22"></td>
</tr>
<tr>
<td><span class="test">HTML Code:</span></td>
<td height="22"></td>
<td><input name='htmlcode' type='text' align='center' size='85' value='<a href="http://ooop.co.uk/"><img src="<?php echo "$urltoimages/$name" ?>"/></a>' /></td>
</tr>
<tr>
<td height="22"></td>
<td height="22"></td>
<td height="22"></td>
</tr>
<tr>
<td height="3" colspan="3" bgcolor="#244386"></td>
</tr>
<tr>
<td height="22" colspan="3" valign="bottom"><div align="right"><span class="footer">About | Contact Us | Advertise | Jobs | Terms of Use</span></div></td>
</tr>
</table>
<p><span class="title">
<?php
}
}
if ($done <> "yes") { print "<p><b>Error:</b> Your image as not been uploaded becuase it is not a recognised image file. Please try again.</p>"; }
}
}
?>
</span></p>
</body>
</html>
and this is what i want to put on the uploader bit
<table width="836" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="0" colspan="5"></td>
</tr>
<tr>
<td height="21" colspan="5" background="file:///C|/Users/Joshua/Ooop/Server/uploader_top.gif"></td>
</tr>
<tr>
<td width="18" rowspan="5" background="file:///C|/Users/Joshua/Ooop/Server/uploader_left.gif"></td>
<td width="300" rowspan="5" bgcolor="#294D96"><a href="http://accessories.skype.com/servlet/ControllerServlet?Action=DisplayPage&Env=BASE&Loca le=en_GB&SiteID=skypeeu&id=ProductDetailsPage&prod uctID=78051200&tduid=beffcf9c6674002cd6066a33033b2 e6c" target="_blank"><img src="file:///C|/Users/Joshua/Ooop/Server/advert.gif" width="300" height="250" /></a></td>
<td width="13" rowspan="5" bgcolor="#294D96"></td>
<td valign="top" bgcolor="#294D96" class="title">Uploader</td>
<td width="26" rowspan="5" background="file:///C|/Users/Joshua/Ooop/Server/uploader_right.gif"></td>
</tr>
<tr>
<td height="5" bgcolor="#294D96"></td>
</tr>
<tr>
<td height="3" bgcolor="#FFFFFF"></td>
</tr>
<tr>
<td height="15" bgcolor="#294D96"></td>
</tr>
<tr>
<td bgcolor="#294D96"><label></label></td>
</tr>
<tr bgcolor="#000000">
<td height="26" colspan="5" background="file:///C|/Users/Joshua/Ooop/Server/uploader_bottom.gif" bgcolor="#FFFFFF"></td>
</tr>
</table>
<table width="810" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="810" height="19" align="right" valign="bottom"><div align="right" class="style2">
<div align="right"> About | Terms of Service | Jobs | Contact | Advertise</div>
</div></td>
</tr>
</table>
</body>
</html>
if you could merge the 2 togethor so it would work it would be a big help.
and p.s im not very good at codeing more of a video man, so please dont go ripping me on how balls my code is.
this is the code
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Ooop » Free Image Hosting</title>
<style type="text/css">
<!--
body {
background-image: url(top_bar.gif);
background-repeat: repeat-x;
margin-top: 170px;
}
.test {
font-family: "myriad Pro";
font-weight: bold;
color: #244386;
}
.title {
font-size: 24px;
font-family: "myriad Pro";
color: #244386;
font-weight: bold;
letter-spacing: -1.8px;
}
.footer {
font-family: "myriad Pro";
color: #244386;
font-size: 12px;
font-weight: bold;
a:hover
}
.a:hover {
font-family: "myriad Pro";
color: #244386;
font-size: 12px;
font-weight: bold;
text-decoration: underline;
}
#logo {
position:absolute;
left:19px;
top:31px;
width:188px;
height:56px;
z-index:1;
background:logo.png;
background-image: url(logo.png);
}
-->
</style>
</head>
<body>
<div id="logo"></div>
<!-- All the kinds of code you want to be outputed go here --><?
// CONFIG
$serverpath = "images/";
$urltoimages = "http://ooop.co.uk/images";
$maxsize = "5000000";
$uniq = uniqid("");
// CONFIG END
$mode = $_GET['mode'];
if ($mode == "") { $mode = "form"; }
if ($mode == "form") {
echo "<form enctype='multipart/form-data' method='post' action='?mode=upload'>\n";
echo "Upload file: <input type='file' name='file'>\n";
echo "<br><input type='submit' name='Submit' value='Upload'>\n";
echo "<br>Maximum File Size: 5$maxsizeb MB";
echo "<br>hi im drew, and i like ponys";
echo "<br>$file";
}
if ($mode == "upload") {
$file = $_FILES['file']['name'];
$name = time() . substr($file, -4);
$allowedfiles[] = "gif";
$allowedfiles[] = "jpg";
$allowedfiles[] = "jpeg";
$allowedfiles[] = "jfef";
$allowedfiles[] = "jpe";
$allowedfiles[] = "png";
$allowedfiles[] = "GIF";
$allowedfiles[] = "JPG";
$allowedfiles[] = "JPEG";
$allowedfiles[] = "JFEF";
$allowedfiles[] = "JPE";
$allowedfiles[] = "PNG";
$allowedfiles[] = "bmp";
$allowedfiles[] = "BMP";
$allowedfiles[] = "tif";
$allowedfiles[] = "tiff";
$allowedfiles[] = "TIF";
$allowedfiles[] = "TIFF";
if($_FILES['file']['size'] > $maxsize)
{
print "File size is too big - please reduce file size and try again.";
}
else {
$path = "$serverpath/" . $name;
foreach($allowedfiles as $allowedfile) {
if ($done <> "yes") {
if (file_exists($path)) {
echo "A file with this name already exists - please rename the file and reupload.";
exit;
}
}
if (substr($file, -3) == $allowedfile) {
move_uploaded_file($_FILES['file']['tmp_name'], "$path");
$done = "yes";
echo "<p></p>";
?>
</span>
<table width="656" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td colspan="3" class="title"><span class="title">
File successfully uploaded</span></td>
</tr>
<tr>
<td height="3" colspan="3"></td>
</tr>
<tr>
<td height="3" colspan="3" bgcolor="#244386"></td>
</tr>
<tr>
<td height="15" colspan="3"></td>
</tr>
<tr>
<td colspan="3"><div align="center"><span class="test"><img src="<?php echo "$urltoimages/$name"?>" /></span></div></td>
</tr>
<tr>
<td height="15" colspan="3"></td>
</tr>
<tr>
<td width="92" height="22"><span class="test">Direct Link:</span></td>
<td width="24" height="22"></td>
<td width="540"><input name='direct' type='text' align='center' size='85' value='<?php echo "$urltoimages/$name" ?>' /></td>
</tr>
<tr>
<td height="22"></td>
<td height="22"></td>
<td height="22"></td>
</tr>
<tr>
<td><span class="test">IMG Code:</span></td>
<td height="22"></td>
<td><input name='imgcode' type='text' align='center' size='85' value='<?php echo "$urltoimages/$name" ?> (http://ooop.co.uk/)' /></td>
</tr>
<tr>
<td height="22"></td>
<td height="22"></td>
<td height="22"></td>
</tr>
<tr>
<td><span class="test">HTML Code:</span></td>
<td height="22"></td>
<td><input name='htmlcode' type='text' align='center' size='85' value='<a href="http://ooop.co.uk/"><img src="<?php echo "$urltoimages/$name" ?>"/></a>' /></td>
</tr>
<tr>
<td height="22"></td>
<td height="22"></td>
<td height="22"></td>
</tr>
<tr>
<td height="3" colspan="3" bgcolor="#244386"></td>
</tr>
<tr>
<td height="22" colspan="3" valign="bottom"><div align="right"><span class="footer">About | Contact Us | Advertise | Jobs | Terms of Use</span></div></td>
</tr>
</table>
<p><span class="title">
<?php
}
}
if ($done <> "yes") { print "<p><b>Error:</b> Your image as not been uploaded becuase it is not a recognised image file. Please try again.</p>"; }
}
}
?>
</span></p>
</body>
</html>
and this is what i want to put on the uploader bit
<table width="836" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td height="0" colspan="5"></td>
</tr>
<tr>
<td height="21" colspan="5" background="file:///C|/Users/Joshua/Ooop/Server/uploader_top.gif"></td>
</tr>
<tr>
<td width="18" rowspan="5" background="file:///C|/Users/Joshua/Ooop/Server/uploader_left.gif"></td>
<td width="300" rowspan="5" bgcolor="#294D96"><a href="http://accessories.skype.com/servlet/ControllerServlet?Action=DisplayPage&Env=BASE&Loca le=en_GB&SiteID=skypeeu&id=ProductDetailsPage&prod uctID=78051200&tduid=beffcf9c6674002cd6066a33033b2 e6c" target="_blank"><img src="file:///C|/Users/Joshua/Ooop/Server/advert.gif" width="300" height="250" /></a></td>
<td width="13" rowspan="5" bgcolor="#294D96"></td>
<td valign="top" bgcolor="#294D96" class="title">Uploader</td>
<td width="26" rowspan="5" background="file:///C|/Users/Joshua/Ooop/Server/uploader_right.gif"></td>
</tr>
<tr>
<td height="5" bgcolor="#294D96"></td>
</tr>
<tr>
<td height="3" bgcolor="#FFFFFF"></td>
</tr>
<tr>
<td height="15" bgcolor="#294D96"></td>
</tr>
<tr>
<td bgcolor="#294D96"><label></label></td>
</tr>
<tr bgcolor="#000000">
<td height="26" colspan="5" background="file:///C|/Users/Joshua/Ooop/Server/uploader_bottom.gif" bgcolor="#FFFFFF"></td>
</tr>
</table>
<table width="810" border="0" align="center" cellpadding="0" cellspacing="0">
<tr>
<td width="810" height="19" align="right" valign="bottom"><div align="right" class="style2">
<div align="right"> About | Terms of Service | Jobs | Contact | Advertise</div>
</div></td>
</tr>
</table>
</body>
</html>
if you could merge the 2 togethor so it would work it would be a big help.
and p.s im not very good at codeing more of a video man, so please dont go ripping me on how balls my code is.