Upload content onto Bootstrap card
-
Hey there!!!
Im trying to attach image upload to bootstrap card(home.php) as well place the image in gallery(gallery.php). When I hit submit Im taken to a blank page instead of seeing image displayed on home page. Here is my code:
```
Upload Image
Close
query($query);
// Loop thru comments and display all of them
while($row = $result->fetch_array(MYSQLI_ASSOC) ) {
printf("%s (%s)\n", $row["username"], $row["comment"],$row["image"]);
?>[  ](pro.php)
```
```
5242880){
echo "alert('File too large!')";
echo "window.location = 'home.php'";
}else{
if(move_uploaded_file($image_temp, $path)){
mysqli_query($conn, "INSERT INTO `image` VALUES('', '$name', '$path')") or die(mysqli_error());
echo "alert('Image uploaded!')";
echo "window.location = 'home.php'";
}
}
}else{
echo "alert('Invalid image format!')";
echo " -
Hey there!!!
Im trying to attach image upload to bootstrap card(home.php) as well place the image in gallery(gallery.php). When I hit submit Im taken to a blank page instead of seeing image displayed on home page. Here is my code:
```
Upload Image
Close
query($query);
// Loop thru comments and display all of them
while($row = $result->fetch_array(MYSQLI_ASSOC) ) {
printf("%s (%s)\n", $row["username"], $row["comment"],$row["image"]);
?>[  ](pro.php)
```
```
5242880){
echo "alert('File too large!')";
echo "window.location = 'home.php'";
}else{
if(move_uploaded_file($image_temp, $path)){
mysqli_query($conn, "INSERT INTO `image` VALUES('', '$name', '$path')") or die(mysqli_error());
echo "alert('Image uploaded!')";
echo "window.location = 'home.php'";
}
}
}else{
echo "alert('Invalid image format!')";
echo "Your code is vulnerable to SQL Injection[^]. NEVER use string concatenation to build a SQL query. ALWAYS use a parameterized query. PHP: SQL Injection - Manual[^] PHP: Prepared statements and stored procedures - Manual[^]
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
Hey there!!!
Im trying to attach image upload to bootstrap card(home.php) as well place the image in gallery(gallery.php). When I hit submit Im taken to a blank page instead of seeing image displayed on home page. Here is my code:
```
Upload Image
Close
query($query);
// Loop thru comments and display all of them
while($row = $result->fetch_array(MYSQLI_ASSOC) ) {
printf("%s (%s)\n", $row["username"], $row["comment"],$row["image"]);
?>[  ](pro.php)
```
```
5242880){
echo "alert('File too large!')";
echo "window.location = 'home.php'";
}else{
if(move_uploaded_file($image_temp, $path)){
mysqli_query($conn, "INSERT INTO `image` VALUES('', '$name', '$path')") or die(mysqli_error());
echo "alert('Image uploaded!')";
echo "window.location = 'home.php'";
}
}
}else{
echo "alert('Invalid image format!')";
echo "