i have an image uploading script with php it work will in localhost server but when I upload the website to my domain server it will upload the image but not in the spathfic folder I set it well set the folders path as part of the image name like
the path is
admin\upload\novelimage
the image name will be like this
upload\novelimage\...image that uploaded
i didnt no if it is error in the script or the server but i didnt see any need for uploads permission on thier side so i guess that the problem was on the script here is the script
//upload files
$avatarname = $_FILES['NovelImage']['name'];
$avatarsize = $_FILES['NovelImage']['size'];
$avatartmp = $_FILES['NovelImage']['tmp_name'];
$avatartype = $_FILES['NovelImage']['type'];
$avatarAllowedextention = array("jpeg", "jpg", "png", "gif");
//get avatar extention
$avatarextention = strtolower(end(explode('.', $avatarname)));
#get the varibles from the form
$Novelname = $_POST['Novelname'];
$Describe = $_POST['Describe'];
$category = $_POST['langOpt3'];
// condtion ? true and false
//check username
$formerrors = array();
if (! empty($avatarname) && ! in_array($avatarextention, $avatarAllowedextention)) {
$formerrors[] = 'avatar extension is not allowed';
}
if (empty($avatarname)) {
$formerrors[] = 'empty avatar is not allowed';
}
if ($avatarsize > 4194304) {
$formerrors[] = 'avatar size is bigger than 4mb';
}
foreach ($formerrors as $error) {
echo '<div class="alert alert-danger">' . $error . '</div>';
}
if (empty($formerrors)) {
$avatar = rand(0, 1000000) . '_' . $avatarname;
move_uploaded_file($avatartmp, "upload\novelimage\\" . $avatar);
$check = checkitem("NovelName", "novel", $Novelname);
if ($check == 1) {
$theMsg = "<div class='alert alert-danger'>sorry this user name is exit</div>";
redirecthome($theMsg, 'back');
}else{
//insert userinfo into database whith this info
$stmt = $con->prepare("INSERT INTO novel(NovelName, NovelImage, description)
VALUES(:znovel, :zNovelImage, :zdescription)");
$stmt->execute(array(
'znovel' => $Novelname,
'zNovelImage' => $avatar,
'zdescription' => $Describe
));
$lastid = $con->LastInsertId();
$stmt = $con->prepare("INSERT INTO book_category(novelid, categoryID)
VALUES(:znovelid, :zcategoryID)");
foreach ($category as $cat) {
$stmt->execute(array(
'znovelid' => $lastid,
'zcategoryID' => $cat
));
}
}
//erg
$theMsg = "<div class='alert alert-success '>" . $stmt->rowCount(). 'Record Updated</div>';
redirecthome($theMsg, 'back', 100);
}
i really cant see any problem here please help