Quote:
|
Originally Posted by Niklas
umm i dont remember what 755 stands for, but you could try chmoding it to 777 and see if it works
|
Nope! 777 gives me the same warning message:
Here is the code that I am using;
<? // upload.php
// Constants. These are the values that determine if the file is accepted or not.
$dir = "x:/upload/"; // Directory where you want to put the files.
$maxfilesize = 1048576; // File size, in bytes. I've chosen 1MB here, which is 1048576 bytes. This is the usual cap for images.
$maxwidth = 100; // Max width in pixels.
$maxheight = 200; // Max height in pixels. I chose to use a standard screen res that produces about a 1MB image in Photoshop with a 72 dpi. Change as you see fit.
// File information. We'll be checking these values against our constraints above.
$filename = $_FILES['imagefile']['tmp_name']; // File being uploaded.
$filesize = filesize($filename); // File size of the file being uploaded.
$size = getimagesize($filename); // We're going to be using this for a dimensions check.
$width = $size[0]; // Width of the file being uploaded.
$height = $size[1]; // Height of the file being uploaded.
// Error checking and handling. Now we're going to either break out of the script, or we're going to continue onto the final upload.
if($filesize > $maxfilesize)
{
print("Max filesize of $maxfilesize breeched. File will not be accepted.");
unlink($filename); // This will remove the temporary file so we don't have to deal with it anymore.
}
if($width > $maxwidth)
{
print("Max width of $maxwidth breeched. File will not be accepted.");
unlink($filename); // This will remove the temporary file so we don't have to deal with it anymore.
}
if($height > $maxheight)
{
print("Max height of $maxheight breeched. File will not be accepted.");
unlink($filename); // This will remove the temporary file so we don't have to deal with it anymore.
}
// File copy and successful output. The file passed the 3 error check tests, and can not be copied to its final destination.
move_uploaded_file($_FILES['imagefile']['tmp_name'], $dir . $_FILES['imagefile']['name']); // Note that $dir is the directory you wish to upload the final file to. Modify as needed in the constants above.
$filename = $_FILES['imagefile']['name']; // Refresh the filename variable with the final filename, just to keep the variable clean and information up-to-date.
print("File upload complete.<br>Name: $filename<br>File Size: $filesize<br>Width: $width<br>Height: $height");
?>