<?php
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
include("dbConnect.php");
echo '<pre>' ;
print_r($_FILES);
echo '</pre>' ;
echo php_ini_loaded_file()."\n";
move_uploaded_file($_FILES["image"]["tmp_name"], "../img/".$_FILES["image"]["name"]);
$filename = '../img/'.$_FILES["image"]["name"];
$text = '';
$fh = fopen($filename, 'r');
while (!feof($fh)) {
$line = fgets($fh);
$text .= $line . PHP_EOL;
}
fclose($fh);
$sql = "INSERT INTO `Users`(`Name`, `Surname`, `Password`, `Email`, `Image`) VALUES ('".$_POST["name"]."','".$_POST["surname"]."','".$_POST["password"]."','".$_POST["email"]."','".mysqli_real_escape_string($connect, $text)."')";
$connect->query($sql);
mysqli_close($connect);
header('Location: ../profile.php');
<?php
ini_set('display_errors', '1');
ini_set('display_startup_errors', '1');
error_reporting(E_ALL);
include("dbConnect.php");
$tmp_dir = '/var/www/uploads/'; // путь к временной директории из настроек php.ini
$tmp_file = $tmp_dir . basename($_FILES['image']['name']); // путь к временному файлу
move_uploaded_file($tmp_file, "../img/"); // перемещаем файл в временную директорию
mysqli_close($connect);
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Регистрация</title>
</head>
<body>
<div class="account-container">
<h2>Личный кабинет</h2>
<form method="post" action="scripts/register.php">
<label for="username">Имя пользователя:</label>
<input type="text" id="login" name="login" required>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required>
<label for="password">Пароль:</label>
<input type="password" id="password" name="password" required>
<label for="image">Фото профиля:</label>
<input type="file" id="image" name="image">
<button type="submit">Зарегестрироваться</button>
</form>
</div>
</body>
</html>
Notice: Undefined index: image in D:\OSPanelFromTiny10\domains\Vanechka\scripts\register.php on line 10
<Window x:Class="WPF_Learning.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WPF_Learning"
mc:Ignorable="d"
Title="Калькулятор v3 WPF" Height="700" Width="600" FontFamily="Segoe UI Semibold" FontSize="36" Background="#FF2B2A28" MinHeight="576" MinWidth="542" Icon="/pngegg.png">
<Grid x:Name="MainGrid">
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Label x:Name="ExprLabel" Grid.ColumnSpan="5" Foreground="#FFD8D8D8" Margin="0,20,0,0">0</Label>
<Label x:Name="CalculatedLabel" Grid.Column="3" Grid.ColumnSpan="4" HorizontalAlignment="Right" VerticalAlignment="Bottom" Foreground="#FF8C8C8C" Margin="0,0,20,0" FontSize="22">N/E</Label>
<Button Grid.Column="1" Grid.Row="1">1</Button>
<Button Grid.Column="2" Grid.Row="1">2</Button>
<Button Grid.Column="3" Grid.Row="1">3</Button>
<Button Grid.Column="1" Grid.Row="2">4</Button>
<Button Grid.Column="2" Grid.Row="2">5</Button>
<Button Grid.Column="3" Grid.Row="2">6</Button>
<Button Grid.Column="1" Grid.Row="3">7</Button>
<Button Grid.Column="2" Grid.Row="3">8</Button>
<Button Grid.Column="3" Grid.Row="3">9</Button>
<Button Grid.Column="2" Grid.Row="4">0</Button>
<Button x:Name="EquButton" Grid.Column="3" Grid.Row="4" Background="#FFC97922">=</Button>
<Button x:Name="EraseButton" Grid.Column="4" Grid.Row="4" Grid.ColumnSpan="2" Background="#FFC97922" Margin="0,0,60,0">⌫</Button>
<Button Grid.Column="1" Grid.Row="4" >.</Button>
<Button Grid.Column="4" Grid.Row="1" Margin="0,0,60,0">)</Button>
<Button Grid.Column="4" Grid.Row="2" Margin="0,0,60,0">*</Button>
<Button Grid.Column="4" Grid.Row="3" Margin="0,0,60,0">/</Button>
<Button Grid.Column="0" Grid.Row="1" Margin="60,0,0,0">(</Button>
<Button Grid.Column="0" Grid.Row="2" Margin="60,0,0,0">+</Button>
<Button Grid.Column="0" Grid.Row="3" Margin="60,0,0,0">-</Button>
<Button x:Name="ClearButton" Grid.Column="0" Grid.Row="4" Margin="60,0,0,0" Background="#FFC97922">AC</Button>
</Grid>
</Window>
Пусть картинку в БД я положить и не смогу, что означает, что мне придётся переписывать подгрузку картинок на сайте, но тот факт, что теперь отправка картинок работает - уже радует!