Location: PHPKode > scripts > WebPen > webpen/upload.php
<?php
//Webpen v3 - This software is copyright ToucanMultimedia.com 2010. It or any part of it may not be used, sold, or modified without permission of ToucanMultimedia.com.//
include 'config1.php';
$errors = 0;
function getExtension($str) {
$i = strrpos($str,".");
if (!$i) { return ""; }
$l = strlen($str) - $i;
$ext = substr($str,$i+1,$l);
return $ext;
}
if(isset($_POST['submit']))
{
$name= $_FILES['image']['name'];
if ($name)
{
$filename = stripslashes($name);
$extension = getExtension($filename);
$extension = strtolower($extension);
}
if (($extension != "jpg") && ($extension != "jpeg") && ($extension != "png") && ($extension != "gif"))
{
$errors=1;
}
$size=filesize($_FILES['image']['tmp_name']);
if ($size > $maxsize*1024)
{
$errors=2;
}
$newname=$_POST['newdirname'].'/'.$name;
if ($errors == 0) {
$copied = copy($_FILES['image']['tmp_name'], $newname);
}
}
sleep(1);
?>
<script language="javascript" type="text/javascript">window.top.window.stopUpload(<?php echo $errors; ?>);</script> 
Return current item: WebPen