I am having some trouble uploading images to my blog, every time I try summiting the form it returns 'Failed to upload image :'. I can’t figure out the problem
if (!empty($_FILES['image']['name'])) {
$image_name = time() . '_' . $_FILES['image']['name'];
$destination = ROOT_PATH . "/assets/images/" . $image_name;
$result = move_uploaded_file($_FILES['image']['tmp_name'], $destination);
if ($result) {
$_POST['image'] = $image_name;
}else {
array_push($errors, 'Failed to upload image :');
}
}else {
array_push($errors, 'Image is required!');
}
Thanks for the feedback When using mac insure that the destination folder has read and writing permissions for other users.