I asked my hosting provider for help and they turned on allow_url_encode. This didn't help, and I'm not sure it's relevant in this case anyway.
Any ideas? Here's the code:
$path is something like C:\Users\Barb\My Pictures\Recipes
Code: Select all
if ($_POST['image_folder']) {
$path=$_POST['image_folder'];
$limitedext = array(".gif",".jpg",".png",".jpeg",".bmp");
//check the file's extension
$ext = strtolower(strrchr($image,'.'));
if (in_array($ext,$limitedext)) { //only upload image if it is a valid image file
$targetdir = "imagetmp/$prefix-".$image;
$sourcedir = $path."\\".$image;
if (file_exists($sourcedir)) {
list($width,$height) = getimagesize($sourcedir);
if ($width > 250) {$width = 250;}
if ($height > 250) {$height = 250;}
require_once('thumbnail_create.php');
$a = new Thumbnail($sourcedir,$width,$height,$targetdir,80,'"bevel()"');
$newsourcedir = "imagetmp/$prefix-".$image;
$newtargetdir = "images/recipe/$prefix-".$image;
rename($newsourcedir, $newtargetdir);
}
}
}