首页 > 解决方案 > 在本地服务器(xampp)上正常工作时,无法将图像上传到 Godaddy 服务器中的服务器

问题描述

为什么我不能将图像上传到 Godaddy 服务器中的服务器,而它在本地服务器 (xampp) 上工作正常。这是我的代码:

<?php
session_start();
error_reporting(0);
`include('includes/config.php');`
if(strlen($_SESSION['login'])==0)
  { 
header('location:index.php');
}
else{
if(isset($_POST['submit']))
  {
$testimonoial=$_FILES["fileToUpload"]["name"];
$email=$_SESSION['login'];
$imagetmp=addslashes (file_get_contents($_FILES['fileToUpload']['tmp_name']));
move_uploaded_file($_FILES["fileToUpload"]["tmp_name"],"domuents/img/".$_FILES["fileToUpload"]["name"]);
$sql="INSERT INTO  tbltestimonial(UserEmail,imagename,mytmp) VALUES(:email,:testimonoial,:imagetmp)";
$query = $dbh->prepare($sql);
$query->bindParam(':testimonoial',$testimonoial,PDO::PARAM_STR);
$query->bindParam(':email',$email,PDO::PARAM_STR);
$query->bindParam(':imagetmp',$imagetmp,PDO::PARAM_STR);

$query->execute();
$lastInsertId = $dbh->lastInsertId();
if($lastInsertId)
{
$msg="تم تحميل الوثسقة بنجاح";
}
else 
{
$error="حدث خطا ما . الرجاء اعادة المحاولة";
}

}
?>

这是我的表单代码

<form method="post" enctype="multipart/form-data">
   <div class="form-group">
      <h5 class="uppercase underline">تحميل وثائق</h5>
      <input type="file" name="fileToUpload" class="btn" required>
      <span class="angle_arrow">
          <i class="fa fa-angle-right" aria-hidden="true"></i>
      </span>
      <input type="submit" value="Upload" name="submit" class="btn" style="margin:28px">
   </div>
</form>

我将 godaddy 主机和域与 phpmyadmin 数据库一起使用。我搜索了很多但什么也没有,我也试图删除移动到文件夹文本,什么也没有。我检查了表格是否仍然与本地服务器具有相同的文本并且一切正常。任何帮助将不胜感激

标签: phphtmlmysqlgodaddy-api

解决方案


domuents/img/您的 Godaddy 主机上是否存在该文件夹?特别注意你有一个错字,domuents而我猜你想有documents


推荐阅读