Hi,
I am trying to upload images and am getting this error:
Warning: move_uploaded_file(http://www.freemanholland.com/..../footer.jpg) [function.move-uploaded-file]: failed to open stream: HTTP wrapper does not support writeable connections in /home/migfreem/…/model/db/Product.class.php on line 42
Warning: move_uploaded_file() [function.move-uploaded-file]: Unable to move ‘/tmp/phppwDDVo’ to ‘http://www.freemanholland.com/.../productimages/footer.jpg’ in /home/…/…/…/public_html/cow/application/model/db/Product.class.php on line 42
This is my code:
public function uploadImages(){
$root = "".__SITE_PATH."productimages/";
for($i=1; $i<5; $i++):
if($_FILES['pic'.$i]['name'] != ''):
$target_path = $root . basename( $_FILES['pic'.$i]['name']);
if(move_uploaded_file($_FILES['pic'.$i]['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['pic'.$i]['name'])." has been uploaded to ".$root;
Thumbnail::createthumb($_FILES['pic'.$i]['name'],$root."tn_".$_FILES['pic'.$i]['name'],81,99);
Thumbnail::createthumb($_FILES['pic'.$i]['name'],$root."small_".$_FILES['pic'.$i]['name'],323,390);
Thumbnail::createthumb($_FILES['pic'.$i]['name'],$root."category_".$_FILES['pic'.$i]['name'],153,186);
} else{
die("There was an error uploading the file, please try again!");
}
endif;
endfor;
}
Any ideas what the problem is?
Thanks