Can anyone help me with this one...
I have installed HTMLarea, which allows you to replace text areas with an inline WYSIWYG editor. It also allows file uploads...which is where it all goes wrong
The file should be uploaded to the temp directory, then copied to the actual directory. All directories are set to 777 (Linux Apache platform). I don't think the file is even making it to the temp directory, as it's not there afterwards.
Looking at the code, I think it's using
$HTTP_POST_FILES to do it's stuff, but I'm not entirely sure. The relevant chunk of code is below...
$name = $HTTP_POST_FILES["image"]["name"];
// if File has NO or an improper extension ...
if(!($search($types[$type], $name))) {
$exts = array("image/gif" => ".gif", "image/jpg" => ".jpg", "image/jpeg" => ".jpg", "image/pjpeg" => ".jpg", "image/png" => ".png", "image/x-png" => ".png", "image/bmp" => ".bmp", "image/x-bmp" => ".bmp", "image/x-wmf" => ".wmf");
// ... if NO extension exists ...
if(!($search("[.].+$", $name)))
// ... append the proper extension
$name .= $exts[$type];
// ... otherwise, force a proper extension
else
$name = $replace("[\.].*$", $exts[$type], $name);
// notify the user
$info = "Proper extension was added to make \'" . $name . "\' valid for this image type";
}
// if File has the proper extension now ...
if($search($types[$type], $name)) {
$path = basePath($name);
// ... if File does NOT already exist ...
if(!(file_exists(IMAGE_DIR . $path))) {
$size = $HTTP_POST_FILES["image"]["size"];
// ... if NO size limit exists OR File is NOT over the limit ...
if(UPLOAD_LIMIT == 0 || $size <= UPLOAD_LIMIT) {
// ... if File CANNOT be copied ...
if(!(@copy($temp, (IMAGE_DIR . $path))))
// ... report the error
$error = "File \'" . IMAGE_DIR . "\\" . $path . "\' could not be created";