



How can it be dangerous
I have three records in table
Every records have multiple data into another table but my issue is I want show the data serial wise like example
A, B, C
This is three record
A1, A2
B1, B2
C1, C2
This record link to A, B, C
if (isset($_POST[‘upload’])){
$book= $_POST[‘book’];
$author=$_POST[‘author’];
$about=$_POST[‘about’];
$story=$_POST[‘story’];
$file=$_FILES[‘file’];
$filename=$_file[‘name’];
$fileerror=$files[‘error’];
$filetmp=$file[‘tmp_name’];
$fileext=explode(‘.’,$filename);
$filecheck=strtolower(end($fileout));
$fileextstored= array(‘png’,’jpg’,’jpeg’);
if(in_array($filecheck,$fileextstored)){
$destinationfile=”images/”.$filename;
move_uploaded_file($filetmp,$destinationfile);
$q=”INSERT INTO books(image, heading, author, about, story) VALUES (‘$destinationfile’,’$book’,’$author’,’$about’,’$story’)”;
$query= mysqli_query($conn,$q);
if (move_uploaded_file($_FILES[‘image’][‘tmp_name’], $target)) {
$msg = “Image uploaded successfully”;
}else{
$msg = “Failed to upload image”;
}
}
}
?>
if (isset($_POST[‘upload’])){
$book= $_POST[‘book’];
$author=$_POST[‘author’];
$about=$_POST[‘about’];
$story=$_POST[‘story’];
$file=$_FILES[‘file’];
$filename=$_file[‘name’];
$fileerror=$files[‘error’];
$filetmp=$file[‘tmp_name’];
$fileext=explode(‘.’,$filename);
$filecheck=strtolower(end($fileout));
$fileextstored= array(‘png’,’jpg’,’jpeg’);
if(in_array($filecheck,$fileextstored)){
$destinationfile=”images/”.$filename;
move_uploaded_file($filetmp,$destinationfile);
$q=”INSERT INTO books(image, heading, author, about, story) VALUES (‘$destinationfile’,’$book’,’$author’,’$about’,’$story’)”;
$query= mysqli_query($conn,$q);
if (move_uploaded_file($_FILES[‘image’][‘tmp_name’], $target)) {
$msg = “Image uploaded successfully”;
}else{
$msg = “Failed to upload image”;
}
}
}
?>
What’s the issue
image uploading
$book= $_POST[‘book’];
$author=$_POST[‘author’];
$about=$_POST[‘about’];
$story=$_POST[‘story’];
$file=$_FILES[‘file’];
$filename=$_file[‘name’];
$fileerror=$files[‘error’];
$filetmp=$file[‘tmp_name’];
$fileext=explode(‘.’,$filename);
$filecheck=strtolower(end($fileout));
$fileextstored= array(‘png’,’jpg’,’jpeg’);
if(in_array($filecheck,$fileextstored)){
$destinationfile=”images/”.$filename;
move_uploaded_file($filetmp,$destinationfile);
$q=”INSERT INTO books(image, heading, author, about, story) VALUES (‘$destinationfile’,’$book’,’$author’,’$about’,’$story’)”;
$query= mysqli_query($conn,$q);
if (move_uploaded_file($_FILES[‘image’][‘tmp_name’], $target)) {
$msg = “Image uploaded successfully”;
}else{
$msg = “Failed to upload image”;
}
}
}
?>
<input type=”hidden” name=”size” value=”1000000″>
<label for=”formFileSm” class=”form-label”> Upload book cover</label>
<input class=”form-control form-control-sm” id=”formFileSm” type=”file” name=”image”><br>
<textarea class=”form-control” placeholder=”Book Name” id=”floatingTextarea” name=”book”></textarea><br>
<textarea class=”form-control” placeholder=”Author name” id=”floatingTextarea” name=”author”></textarea><br>
<textarea class=”form-control” placeholder=”About the book” id=”floatingTextarea” name=”about”></textarea><br>
<textarea id=”editor” name=”story” > Write your book.. </textarea> <br><br>
<button class=”submitbutton” type=”submit” name=”upload”>Submit</button>
</form>
What is expected output
What it actually output
what is the error dude, cant you tell in one
line??

send line 93
use image inside $_FILE
$book= $_POST[‘book’];
$author=$_POST[‘author’];
$about=$_POST[‘about’];
$story=$_POST[‘story’];
$file=$_FILES[‘file’];
$filename=$_file[‘name’];
$fileerror=$files[‘error’];
$filetmp=$file[‘tmp_name’];
$fileext=explode(‘.’,$filename);
$filecheck=strtolower(end($fileout));
$fileextstored= array(‘png’,’jpg’,’jpeg’);
if(in_array($filecheck,$fileextstored)){
$destinationfile=”images/”.$filename;
move_uploaded_file($filetmp,$destinationfile);
$q=”INSERT INTO books(image, heading, author, about, story) VALUES (‘$destinationfile’,’$book’,’$author’,’$about’,’$story’)”;
$query= mysqli_query($conn,$q);
if (move_uploaded_file($_FILES[‘image’][‘tmp_name’], $target)) {
$msg = “Image uploaded successfully”;
}else{
$msg = “Failed to upload image”;
}
}
}
?>
and write code with proper syntax, somewhere using file and somewhere FILE, both are different, learn php then do things
+1
learn English first