Edited my post so it would be more clear. I have successfully got script to upload images and their thumbnails to folder specified on webserver. I would like to put both image path and resized_image path into mysql database. I have no idea where to start. is some script necessary in upload_image_script.php or my_file.php?Please help , maybe someone can show some kind of example...
upload_image_script.php:
<?php
$fileName = $_FILES["uploaded_file"]["name"];
$fileTmpLoc = $_FILES["uploaded_file"]["tmp_name"];
$fileType = $_FILES["uploaded_file"]["type"];
$fileSize = $_FILES["uploaded_file"]["size"];
$fileErrorMsg = $_FILES["uploaded_file"]["error"];
$kaboom = explode(".", $fileName);
$fileExt = end($kaboom);
if (!$fileTmpLoc) {
echo "ERROR: Please browse for a file before clicking the upload button.";
exit();
} else if($fileSize > 5242880) {
echo "ERROR: Your file was larger than 5 Megabytes in size.";
unlink($fileTmpLoc);
exit();
} else if (!preg_match("/.(gif|jpg|png)$/i", $fileName) ) {
echo "ERROR: Your image was not .gif, .jpg, or .png.";
unlink($fileTmpLoc);
exit();
} else if ($fileErrorMsg == 1) {
echo "ERROR: An error occured while processing the file. Try again.";
exit();
}
$moveResult = move_uploaded_file($fileTmpLoc, "uploads/original/$fileName");
if ($moveResult != true) {
echo "ERROR: File not uploaded. Try again.";
unlink($fileTmpLoc);
exit();
}
include_once("ak_php_img_lib_1.0.php");
$target_file = "uploads/original/$fileName";
$resized_file = "uploads/resized/resized_$fileName";
$wmax = 100;
$hmax = 50;
ak_img_resize($target_file, $resized_file, $wmax, $hmax, $fileExt);
echo "The file named <strong>$fileName</strong> uploaded successfuly.<br /><br />";
echo "It is <strong>$fileSize</strong> bytes in size.<br /><br />";
echo "It is an <strong>$fileType</strong> type of file.<br /><br />";
echo "The file extension is <strong>$fileExt</strong><br /><br />";
echo "The Error Message output for this upload is: $fileErrorMsg";
?>
and my_file.php
<!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>Untitled Document</title>
</head>
<body>
<form name="form" enctype="multipart/form-data" method="POST" action="image_upload_script.php">
<p>Choose your file:
<input name="uploaded_file" type="file" />
</p>
<p>
<input type="submit" value="upload" />
<input type="hidden" name="MM_insert" value="form" />
</p>
</form>
</body>
</html>