I am getting the following error...
Warning: Division by zero in image.php on line 43
Here is the code...
<head>
<title>Images upload script - v0.2 - GDteam</title>
<style type="text/css">
a { font-family: Tahoma; font-size: 10pt; text-decoration: none; color: 808080 }
a:hover { font-family: Tahoma; font-size: 10pt; text-decoration: underline; color: 000000 }
input, textarea, select, object {
font-family: Tahoma; font-size: 10px; border: 1px solid #000000; background-color: #99CCFF
}
BODY {
scrollbar-face-color:#99CCFF;
scrollbar-highlight-color:#FFFFFF;
scrollbar-3dlight-color:#C0C0C0;
scrollbar-darkshadow-color:#C0C0C0;
scrollbar-shadow-color:#808080;
scrollbar-arrow-color:#000000;
scrollbar-track-color:#FFFFFF;
}
.normal {
font-size: 10pt;
font-family: Tahoma;
}
</style>
</head>
<body class="normal">
<h1>Images upload script</h1>
<small>version 0.2 written for gamecentar.com by <a href="http://www.gd-team.cjb.net">GDteam</a></small><br>
if you have any questions or comments writte us on <a href="mailto:gdteam@gamecentar.co.yu">email</a><br><br>
<?php
//_________________________________________
//This script is created by GDteam [http://www.gdteam.cjb.net]
//_________________________________________
//_________________________________________
//START OF CONFIGURATION
//______________________________________
//relative path from this script to folder where images must upload
$dir=images/thumbnails;
//apsolut URL path from begin of your site
$apsolut_dir="http://www.journeys-intl.com/images/thumbnails";
//______________________________________
//END OF CONFIGURATION
//_________________________________________
//begin of code
if (!$func) {
$func = "one";
}
switch ($func) {
case one:
//display form for upload
//the max size od image is 2MB (limited by PHP)
echo "<form method=\"post\" enctype=\"multipart/form-data\" action=\"imageupload.php\">";
echo "Please enter the path to the image on your HDD (use browse button) and optional, the new name of the file without extension:<br><br><input type=\"file\" name=\"uploadedfile\" size=\"30\">";
echo " <input type=\"text\" name=\"name\" value=\"\">";
echo "<input type=\"hidden\" name=\"max_file_size\" value=\"100000\">";
echo "<input type=\"hidden\" name=\"func\" value=\"two\">";
echo " <input type=\"submit\" value=\"Send\">";
break;
case two:
//collect the name from POST VARS
$ime="{$HTTP_POST_VARS['name']}";
//get type of file
$ekst=$uploadedfile_type;
//get lenght of image type
$duzina=strlen($ekst);
//get part of file image to build image extension
$pos=strpos($ekst,"/")+1;
//build extension of image
$ekstenzija=substr($ekst,$pos,$duzina);
//correct errors with some images
//jpg
if($ekstenzija=="pjpeg"){
$ekstenzija="jpg";
}
//png
if($ekstenzija=="x-png"){
$ekstenzija="png";
}
//wmf
if($ekstenzija=="x-wmf"){
$ekstenzija="wmf";
}
//psd
if($ekstenzija=="octet-stream"){
$ekstenzija="psd";
}
//added in version 0.2
//if the name is empty copy name of image from your HDD
//that correct error if you do not enter new name of image
if (!$ime)
{
$ime=$uploadedfile_name;
}
//build new name of name that you specified, . and extension of image
else {
$ime.=".".$ekstenzija;
}
//if image exist, upload it in correct dir
if($uploadedfile<>"none") {
if(!copy($uploadedfile,"$dir/$ime")) {
//display errors
print("<b>Error:</b> image did not send.<br>");
print("Image is too big or it does not exist.<br>");
print("Try again.");
}
//or finish
else {
print("<b>Image has been sent.</b><br><small>image location on server is: <b>$apsolut_dir/$ime</b></small>");
}
}
break;
}
?>
</body>
Can anyone help me figure this out?