Programmiersprache – die besten Beiträge

Website lädt Datei nicht hoch, warum?

Moin, kennt sich vielleicht jemand mit PHP und Html aus und weiß warum beim Upload der Datei nicht das Script "upload.php" ausgeführt wird? Versuche mich gerade beim Scripten, stehe allerdings gerade voll auf dem Schlauch... Danke!

<?php include 'header.php'; ?>
<?php
if(!isset($_SESSION['email'])){
  header('location:login.php');
  $target_file = $target_dir . basename($_FILES["fileToUpload"]["name"]);
}
 ?>
      <div class="breadcrumb">
        <div class="container">
            <a class="breadcrumb-item" href="index.php">Home</a>
            <span class="breadcrumb-item active">Welecome <?php echo $_SESSION['email'] ?></span>
            <span class="breadcrumb-item active">Upload Video</span>
        </div>
    </div>
    <section class="static about-sec">
        <div class="container">
            <h1>Upload Video</h1>
            <div class="form">
                <form class="" action="videoUpload.php" method="post">
                    <div class="row">
                        <div class="col-md-6">
                            <input type="hidden" name="id" value="">
                            <label for="name">Name of Video:</label>
                            <input type="text" name="name" value="" placeholder="Fantasy World" required>
                            <label for="video_url">Video URL</label>
                            <input type="file" name="video_url" required>
                            <label for="description">Description</label>
                            <input type="text" name="description" value="" placeholder="">
                            <label for="category">Category</label>
                            <select name="category">
                              <option value="Classic">Classic</option>
                              <option value="Adventerous">Adventerous</option>
                              <option value="Nature">Nature</option>
                              <option value="Others">Others</option>
                            </select>
                          </div>
                        </div>
							<div class="col-lg-8 col-md-12">
							<form action="upload.php" method="post" enctype="multipart/form-data">
							<input type="submit" class="btn black" value="Upload Image" name="submit">
							</form>
                        </div>
                    </div>
                </form>
            </div>
        </div>
    </section>


    <?php include 'footer.php';?>
HTML, Webseite, HTML5, Code, Datenbank, MySQL, PHP, Programmiersprache, Webdesign, Webentwicklung

Wie implementiere ich eine Mehrfachauswahl?

Kann ich es ermöglichen, dass der Benutzer mehrere Marken oder Baujahre gleichzeitig auswählen kann? Wie würde ich den Query entsprechend anpassen?


<?php
    require "includes/conn.inc.php";
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>Modelle</title>
</head>
<body>
    <h1>Modelle</h1>
    <form method="post">
        <label for="marke">
            Marke
            <input name="marke" type="text">
        </label>
        <label for="modell">
            Modell
            <input name="modell" type="text">
        </label>
        <label for="baujahr">
            Baujahr
            <input name="baujahr" type="text">
        </label>
        <button type="submit">Suchen</button>
    </form>
    <ul>
        <?php
            // Loop through tbl_marken and create WHERE clause
            $where_marke = "";
            if (count($_POST) > 0) {
                if (array_key_exists("marke", $_POST)) {
                    if (strlen($_POST["marke"] > 0)) {
                        $where_marke = "WHERE Markenname LIKE '%" . $_POST["marke"] . "%'";
                    }
                }
            }
            $conn = openConn();
            $markenSql = "
                SELECT 
                    * 
                FROM tbl_marken "
                . $where_marke . "
                ORDER BY Markenname ASC
            ";
            $marken = $conn->query($markenSql) or die($conn->error);
            while ($marke = $marken->fetch_object()) {
                echo "<li>";
                    echo $marke->Markenname;
                echo "</li>";
                
                // Loop through tbl_modell and create WHERE clause
                echo "<ul>";
                    $where_modell = "";
                    if (array_key_exists("modell", $_POST)) {
                        if (strlen($_POST["modell"] > 0)) {
                            $where_modell = " AND Modell LIKE '%" . $_POST["modell"] . "%'";
                        }
                    }
                    $modellSql = "
                        SELECT 
                            * 
                        FROM tbl_modelle 
                        WHERE FIDMarke=" . $marke->IDMarke . $where_modell . "
                        ORDER BY tbl_modelle.Modell ASC
                    ";
                    $modelle = $conn->query($modellSql) or die($conn->error);
                    while ($modell = $modelle->fetch_object()) {
                        echo "<li>";
                            echo $modell->Modell;
                        echo "</li>";   


                        // Loop through baureihen and create WHERE clause
                        echo "<ul>";
                            $where_bau = ["FIDModell=" . $modell->IDModell];
                            if (array_key_exists("baujahr", $_POST)) {
                                if(intval($_POST["baujahr"])>0) {
                                    $where_bau[] = "BaujahrVon<=" . $_POST["baujahr"];
                                    $where_bau[] = "BaujahrBis>=" . $_POST["baujahr"];
                                }
                            }
                            $bauSql = "
                                SELECT 
                                    * 
                                FROM tbl_baureihen 
                                WHERE " . implode(" AND ", $where_bau)
                            ;
                            $baureihen = $conn->query($bauSql) or die($conn->error);
                            while ($baureihe = $baureihen->fetch_object()) {                               
                                echo "<li><a href='modell_teile.php?IDBaureihe=" . $baureihe->IDBaureihe . "'>" . $baureihe->BaujahrVon . " - " . $baureihe->BaujahrBis . " </a></li>";
                            }
                        echo "</ul>";
                    }
                echo "</ul>";
            }
        ?>
    </ul>
</body>
</html>
Datenbank, Programmiersprache

Python discord NonType Error?

Ich habe einen Error in meinem Code:

async def on_submit(self, interaction2: discord.Interaction):
    response = await sendRequests(str(self.username), str(self.email), str(self.password))
    if response == "email":
        await interaction2.response.send_message("Incorrect email format", ephemeral=True)
        return
    if response == "password":
        await interaction2.response.send_message("Incorrect password format. The password must meet these requirements: \nOne Uppercase letter \nOne lowercase letter \nOne number\n A special character ", ephemeral=True)
        return
    if response == "maintenance":
        await interaction2.response.send_message("The system is currently under maintenance. Please look in #news for more infos.", ephemeral=True)
    query = "INSERT INTO users VALUES (?, ?, ?, ?)"
    main.cursor.execute(query, (interaction2.user.id, str(self.username), str(self.email), str(self.password)))
    main.database.commit()
    await interaction2.response.send_message("You are now in the registration process. This can take up to one hour.", ephemeral=True)
    channel = main.bot.get_channel(1309925591146958933)
    await channel.send("make a recaptcha, registration from user : " + str(interaction2.user.name) + " with id: " + str(interaction2.user.id))

Error:
[2024-11-23 19:32:43] [ERROR  ] discord.ui.modal: Ignoring exception in modal <RegisterModal timeout=None children=3>:

Traceback (most recent call last):

 File ".venv\Lib\site-packages\discord\ui\modal.py", line 189, in _scheduled_task

   await self.on_submit(interaction)

 File "TestButton.py", line 41, in on_submit

   await channel.send("make a recaptcha, registration from user : " + str(interaction2.user.name) + " with id: " + str(interaction2.user.id))

         ^^^^^^^^^^^^

AttributeError: 'NoneType' object has no attribute 'send'

Bot, Code, Programmiersprache, Python, Webentwicklung, Python 3, Pycharm, Discord, Discord Bot

Meistgelesene Beiträge zum Thema Programmiersprache