Image Uploading Problem
Posted: Fri Jul 06, 2007 2:47 pm
feyd | Please use
Warnings
Warning: unlink() [function.unlink]: Permission denied in C:\xampp\htdocs\AdminPanel\imageUpload.php on line 24
Warning: imagejpeg(): supplied argument is not a valid Image resource in C:\xampp\htdocs\AdminPanel\imageUpload.php on line 27
Warning: imagesx(): supplied argument is not a valid Image resource in C:\xampp\htdocs\AdminPanel\imageUpload.php on line 34
Warning: imagesy(): supplied argument is not a valid Image resource in C:\xampp\htdocs\AdminPanel\imageUpload.php on line 34
Warning: imagesx(): supplied argument is not a valid Image resource in C:\xampp\htdocs\AdminPanel\imageUpload.php on line 45
Warning: imagesy(): supplied argument is not a valid Image resource in C:\xampp\htdocs\AdminPanel\imageUpload.php on line 46
Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in C:\xampp\htdocs\AdminPanel\imageUpload.php on line 50
Warning: imagesx(): supplied argument is not a valid Image resource in C:\xampp\htdocs\AdminPanel\imageUpload.php on line 53
Warning: imagesy(): supplied argument is not a valid Image resource in C:\xampp\htdocs\AdminPanel\imageUpload.php on line 53
Warning: imagecopyresampled(): supplied argument is not a valid Image resource in C:\xampp\htdocs\AdminPanel\imageUpload.php on line 53
Warning: imagejpeg(): supplied argument is not a valid Image resource in C:\xampp\htdocs\AdminPanel\imageUpload.php on line 56
";
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]
Hi
i am trying to upload an image to the folder know as images which is located at [b]C:\xampp\htdocs\AdminPanel\images[/b]
Here is a Code Through which I am Trying to do it.What type of mistake i am commiting Lots of Warrning are occuring in this process and the image does not get uploaded at desire locationCode: Select all
<?php
// Get the details of "imagefile"
$filename = $_FILES['imagefile']['name'];
$temporary_name = $_FILES['imagefile']['tmp_name'];
$mimetype = $_FILES['imagefile']['type'];
$filesize = $_FILES['imagefile']['size'];
//Open the image using the imagecreatefrom..() command based on the MIME type.
switch($mimetype) {
case "image/jpg":
case "image/jpeg":
$i = imagecreatefromjpeg($temporary_name);
break;
case "image/gif":
$i = imagecreatefromgif($temporary_name);
break;
case "image/png":
$i = imagecreatefrompng($temporary_name);
break;
}
//Delete the uploaded file
unlink($temporary_name);
//Save a copy of the original
imagejpeg($i,"images/Uploadfile.jpg",80);
//Specify the size of the thumbnail
$dest_x = 150;
$dest_y = 150;
//Is the original bigger than the thumbnail dimensions?
if (imagesx($i) > $dest_x or imagesy($i) > $dest_y) {
//Is the width of the original bigger than the height?
if (imagesx($i) >= imagesy($i)) {
$thumb_x = $dest_x;
$thumb_y = imagesy($i)*($dest_x/imagesx($i));
} else {
$thumb_x = imagesx($i)*($dest_y/imagesy($i));
$thumb_y = $dest_y;
}
} else {
//Using the original dimensions
$thumb_x = imagesx($i);
$thumb_y = imagesy($i);
}
//Generate a new image at the size of the thumbnail
$thumb = imagecreatetruecolor($thumb_x,$thumb_y);
//Copy the original image data to it using resampling
imagecopyresampled($thumb, $i ,0, 0, 0, 0, $thumb_x, $thumb_y, imagesx($i), imagesy($i));
//Save the thumbnail
imagejpeg($thumb, "images/thumbnail.jpg", 80);
?>
<html>
<head>
<title>Uploading Image</title>
</head>
<body>
<form action="index.php" method="POST" enctype="multipart/form-data">
<input type="hidden" name="MAX_FILE_SIZE" value="200000">";
<input type="file" name="imagefile">
<input type="submit" name="upload" value="Upload Image">
</form>
</body>
</html>Warnings
Warning: unlink() [function.unlink]: Permission denied in C:\xampp\htdocs\AdminPanel\imageUpload.php on line 24
Warning: imagejpeg(): supplied argument is not a valid Image resource in C:\xampp\htdocs\AdminPanel\imageUpload.php on line 27
Warning: imagesx(): supplied argument is not a valid Image resource in C:\xampp\htdocs\AdminPanel\imageUpload.php on line 34
Warning: imagesy(): supplied argument is not a valid Image resource in C:\xampp\htdocs\AdminPanel\imageUpload.php on line 34
Warning: imagesx(): supplied argument is not a valid Image resource in C:\xampp\htdocs\AdminPanel\imageUpload.php on line 45
Warning: imagesy(): supplied argument is not a valid Image resource in C:\xampp\htdocs\AdminPanel\imageUpload.php on line 46
Warning: imagecreatetruecolor() [function.imagecreatetruecolor]: Invalid image dimensions in C:\xampp\htdocs\AdminPanel\imageUpload.php on line 50
Warning: imagesx(): supplied argument is not a valid Image resource in C:\xampp\htdocs\AdminPanel\imageUpload.php on line 53
Warning: imagesy(): supplied argument is not a valid Image resource in C:\xampp\htdocs\AdminPanel\imageUpload.php on line 53
Warning: imagecopyresampled(): supplied argument is not a valid Image resource in C:\xampp\htdocs\AdminPanel\imageUpload.php on line 53
Warning: imagejpeg(): supplied argument is not a valid Image resource in C:\xampp\htdocs\AdminPanel\imageUpload.php on line 56
";
feyd | Please use
Code: Select all
,Code: Select all
and [syntax="..."] tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read: [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]