Public feed #598472

Mine

public text v1 · immutable
Raw Edit
·published 2007-07-01 11:06 UTC
rendered paste body
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html/strict.dtd">
<html lang="en">
<head>
<title>EddieKlicks.com</title>
<meta name="author" content="James Jeffery">
<meta name="keywords" content="Keywords Here">
<meta name="description" content="Short Description">
<meta http-equiv="content-type" content="text/html; charset=UTF-8">
<link rel="../index" href="index.php">
<style type="text/css">

form {
	width: 400px;
	margin: 0 auto;}

fieldset {
	border: 0;}

legend {
	display: none;}

fieldset div {
	overflow: hidden;
	margin: 10px;}
	
fieldset div label {
	float: left;
	width: 80px;}
	
fieldset div input {
	border: 1px #000 solid;}

div.error {
	width: 200px;
	margin: 0 auto;
	color: #1D96D3;
	text-align: center;
	}
	
</style>
</head>

<body>
	<form action="<?php $_SERVER['SCRIPT_NAME']; ?>" method="post" enctype="multipart/form-data">
		<fieldset>
			<legend>Upload Your .ZIP</legend>
				<div><label for="upload">Upload:</label><input type="file" name="upload" id="upload"></div>
				<div><label for="club">Club:</label><input type="text" name="club" id="club"></div>
				<div><label for="date">Date:</label><input type="text" name="date" id="date"></div>
				<div><input type="submit" name="submit" id="submit" value="submit"></div>
		</fieldset>
	</form>
<?php
 ######################################
 ###									###
 ###	Script Creator: James Jeffery			###                   
 ###	Contact: cascadingstylez@googlemail.com		###
 ###	Skype: james.jeffery.designer				###
 ###	www.jamesjeffery.co.uk					###	
 ###	---------							###
 ###	PCL Library: www.phpconcept.net			###
 ######################################
 
	/* Load in the PclZip Library */
	require_once('../inc/pclzip.lib.php');

	/* Upload Form */
	if($_SERVER['REQUEST_METHOD'] == 'POST'){
		/*Form Variables */
		$upload = $_FILES['upload']['name'];
		$club = $_POST['club'];
		$date = $_POST['date'];
		
		/* Directory Paths */
		$tmpDir = "../galleries/tmp/{$club}-{$date}/";
		$imgDir = "../galleries/{$club}-{$date}/";
		
		/* Form Validation */
		if(!(empty($upload)) && !(empty($club)) && !(empty($date))){
		
			/*If folder dont exist, create it  */
			if(!file_exists($tmpDir)){
				mkdir($tmpDir, 0700);}
			
			/* Upload the .zip to the folder. */
			if(isset($_FILES['upload']) && ($_FILES['upload']['error'] == UPLOAD_ERR_OK)){
				
				if(move_uploaded_file($_FILES['upload']['tmp_name'], $tmpDir.$upload)){
					print "$tmpDir.$upload";}
					
				else {print 'error';}
			}
		}
		
		/* If one or all of the fields are empty display this  error. */
		else {
			print 'Please Fill in all fields!';}
	}		

	
?>	
</body>
</html>