将上传文件夹的路径到主机的问题

发布于 2025-01-31 08:05:58 字数 3896 浏览 3 评论 0原文

我有一个“上传”文件夹,该文件夹根据PHP和MySQL的数据库显示了一些视频,问题是在Localhost中它有效,但是当我将文件插入主机的文件管理器(000webhost)时,主机无法识别。路径“上传”,这是完整的代码,问题在代码末尾的视频SRC中。

<?php
require_once("config.php");
$result=' ';
$cerca=$_POST["cerca"];
$sql = "SELECT * FROM artisti WHERE nome like '%".$cerca."%'";

$result = $conn->query($sql);

if ($result->num_rows > 0)
{
  //echo "<h1>Artisti trovato</h1>";
  while ($row = $result->fetch_assoc()) {
    $ID=$row["ID"];
    $nome=$row["nome"];
    $link=$row["link"];
    $album=$row["album"];
    //echo "<h2>ID: "."$ID"."</h2>";
    //echo "nome: "."$nome"."<br>";
  }
}
else {
  echo "nessun artista trovato";
  $conn->close();
  exit;
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Utopia-Playlist</title>
    <!--Reset css per ogni broswer-->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css" integrity="sha512-NmLkDIU1C/C88wi324HBc+S2kLhi08PN5GDeUVVVC/BVt/9Izdsc9SVeVfA1UZbY3sHUlDSyRXhCzHfr6hmPPw==" crossorigin="anonymous" />
    <!--Script scroll-->
    <script src="https://unpkg.com/[email protected]/dist/scrollreveal.min.js"></script>
    <!--Icone-->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w==" crossorigin="anonymous" />
    <!--Icona tab di google-->
    <link rel="icon" href="Fulmine viola bianco.png">
    
    
    <link rel="stylesheet" href="hero.css">
    <link rel="stylesheet" href="nav.css">
    <link rel="stylesheet" href="playlist1.css">


    <style>
        @import url('https://fonts.googleapis.com/css2?family=Overpass&display=swap');
        </style>
    
</head>
<body>
<!--NavBar-->
<header class="he">
    <h1 class="developers">Utopia Playlist</h1>
    <nav>
        <div class="listanav">
            <li class="icon"><a href="index.html">Home</a></li>
                <li><a href="#">Playlist <i class="fas fa-caret-down"></i></a>
                    <ul class="submenu">
                        <li><a href="consigli.html">Consigli</a></li>
                        <li>
                            <a href="playlist.html">Consigli-DV</a>
                        </li>
                        <li> <a href="top.html">Top 50</a></li>
                    </ul>
                </li>
                <li><a href="contact.php">Contattaci</a></li>
            </div>
            </div>

    </nav>
    <a href="loginpage.php"><button type="button" class="accedi">Accedi</button></a>
</header>

<!--Hero--> <!-- class="btn" -->
    <div class="hero">
        <div class="hero-cn scroll">
            <p class="intro-text">ASCOLTA I NOSTRI CONSIGLI!</p>
            <?php echo "<h1 class=grande-text>"."$nome"."</h1>"?>
            <?php echo "<a class=btn href=$album>Scopri di più</a>" ?>

        </div>

        <video autoplay muted loop class="vd">
            <source src="uploads/<?php echo $link?>" type="video/mp4" >
        </video>

    </div>

I have an "uploads" folder that according to the database with php and mysql shows some videos, the problem is that in localhost it works, but when I insert the files in the file manager of the host (000webhost), the host cannot recognize the path "uploads", this is full code, the problem is in the video src at the end of the code.

<?php
require_once("config.php");
$result=' ';
$cerca=$_POST["cerca"];
$sql = "SELECT * FROM artisti WHERE nome like '%".$cerca."%'";

$result = $conn->query($sql);

if ($result->num_rows > 0)
{
  //echo "<h1>Artisti trovato</h1>";
  while ($row = $result->fetch_assoc()) {
    $ID=$row["ID"];
    $nome=$row["nome"];
    $link=$row["link"];
    $album=$row["album"];
    //echo "<h2>ID: "."$ID"."</h2>";
    //echo "nome: "."$nome"."<br>";
  }
}
else {
  echo "nessun artista trovato";
  $conn->close();
  exit;
}
?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Utopia-Playlist</title>
    <!--Reset css per ogni broswer-->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/meyer-reset/2.0/reset.min.css" integrity="sha512-NmLkDIU1C/C88wi324HBc+S2kLhi08PN5GDeUVVVC/BVt/9Izdsc9SVeVfA1UZbY3sHUlDSyRXhCzHfr6hmPPw==" crossorigin="anonymous" />
    <!--Script scroll-->
    <script src="https://unpkg.com/[email protected]/dist/scrollreveal.min.js"></script>
    <!--Icone-->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css" integrity="sha512-iBBXm8fW90+nuLcSKlbmrPcLa0OT92xO1BIsZ+ywDWZCvqsWgccV3gFoRBv0z+8dLJgyAHIhR35VZc2oM/gI1w==" crossorigin="anonymous" />
    <!--Icona tab di google-->
    <link rel="icon" href="Fulmine viola bianco.png">
    
    
    <link rel="stylesheet" href="hero.css">
    <link rel="stylesheet" href="nav.css">
    <link rel="stylesheet" href="playlist1.css">


    <style>
        @import url('https://fonts.googleapis.com/css2?family=Overpass&display=swap');
        </style>
    
</head>
<body>
<!--NavBar-->
<header class="he">
    <h1 class="developers">Utopia Playlist</h1>
    <nav>
        <div class="listanav">
            <li class="icon"><a href="index.html">Home</a></li>
                <li><a href="#">Playlist <i class="fas fa-caret-down"></i></a>
                    <ul class="submenu">
                        <li><a href="consigli.html">Consigli</a></li>
                        <li>
                            <a href="playlist.html">Consigli-DV</a>
                        </li>
                        <li> <a href="top.html">Top 50</a></li>
                    </ul>
                </li>
                <li><a href="contact.php">Contattaci</a></li>
            </div>
            </div>

    </nav>
    <a href="loginpage.php"><button type="button" class="accedi">Accedi</button></a>
</header>

<!--Hero--> <!-- class="btn" -->
    <div class="hero">
        <div class="hero-cn scroll">
            <p class="intro-text">ASCOLTA I NOSTRI CONSIGLI!</p>
            <?php echo "<h1 class=grande-text>"."$nome"."</h1>"?>
            <?php echo "<a class=btn href=$album>Scopri di più</a>" ?>

        </div>

        <video autoplay muted loop class="vd">
            <source src="uploads/<?php echo $link?>" type="video/mp4" >
        </video>

    </div>

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

痕至 2025-02-07 08:05:58

也许您应该再次检查一些:

  1. $ link变量尚未获得该
  2. 文件夹的位置的值,
  3. 请​​检查连接是否连接到托管数据库,请检查连接

maybe there are some that you should check again:

  1. The $link variable hasn't gotten the value it got
  2. Placement of folders is not the same right
  3. Check the connection whether it is connected to the hosting database or not
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文