使用PHP将多个图像上载到多个Mysql字段

使用PHP将多个图像上载到多个Mysql字段,php,mysql,image,upload,Php,Mysql,Image,Upload,我有一个php表单,我必须通过浏览文件选项来保存单独的文件/图像,以分离mysql列,并通过按下一个确认按钮来保存/插入该列。我查阅了很多教程,但找不到完成这项任务的确切图坦卡门 此处给出了表单视图: 现在建议我如何将这些单独的图片一次性保存到mysql。我只将图像路径保存在mysql中,并将图像移动到一个文件夹中 非常感谢您的帮助 SqL和PHP代码 <?php $valid_formats = array("jpg","jpeg","JPG", "png", "gif",

我有一个php表单,我必须通过浏览文件选项来保存单独的文件/图像,以分离mysql列,并通过按下一个确认按钮来保存/插入该列。我查阅了很多教程,但找不到完成这项任务的确切图坦卡门

此处给出了表单视图:

现在建议我如何将这些单独的图片一次性保存到mysql。我只将图像路径保存在mysql中,并将图像移动到一个文件夹中

非常感谢您的帮助

SqL和PHP代码

     <?php 
$valid_formats = array("jpg","jpeg","JPG", "png", "gif", "bmp");
$max_file_size = 1024*1024*1024;
$dir = "upload/";

// If File Submitted
if($_SERVER['REQUEST_METHOD'] == "POST"){
    $ext = pathinfo($_FILES['profile']['name'], PATHINFO_EXTENSION);
    if ( in_array($ext, $valid_formats)) {
        if( $_FILES['profile']['size'] < $max_file_size ){
            $uniq = base_convert(uniqid(), 16, 10);
            $tmp = $_FILES['profile']['tmp_name'];
            $uniq_file_name = $uniq.".".$ext;
            if(move_uploaded_file($tmp, $dir.$uniq_file_name)){

$query= "INSERT INTO `studentconsultancy`.`student_registration_form` (`ID`,`FirstName`, `LastName`,`DateOfBirth`, `Email`, `LandPhone`, `CellPhone`, `Address`, `Address2`, `City`, `State`, `ZipCode`, `Country`, `InterestLevel`, `InterestLevelOther`, `EnrollYear`, `EnrollSemester`, `InterestCountry`, `InterestCountryOther`, `EnglishProficiency`, `EnglishOther`, `Score`, `Grade`, `YearOfExamTaken`, `CountryOfExamTaken`, `LastAcademicQualification`, `CourseName`, `ResultGrade`, `InstituteName`, `PassportScanCopy`, `AcademicDocumentScanCopy1`, `AcademicDocumentScanCopy2`, `AcademicDocumentScanCopy3`, `AcademicDocumentScanCopy4`, `ProfilePicture`, `NationalIDScanCopy`, `DocList`, `EntryDate`) 

VALUES ('NULL','$firstname', '$lastname', '$date', '$email', '$landphone', '$cellphone', '$address', '$address2', '$city', '$state', '$zip', '$country', '$interestlevel', '$interestlevelother', '$enrollyear', '$enrollsemester', '$interestcountry', '$interestcountryother', '$englishprof', '$english_other', '$score', '$grade', '$yearofexam', '$countryofexam', '$lastacademicq', '$coursename', '$resultgrade','$institutename','$passport','$academic1','$academic2','$academic3','$academic4','$profile','$nid','$doclist',NOW())";

$msg = "Uploading successful!";
            }
            else{
                $msg = "Problem while moving file";
            }
        }
        else{
            $msg = "File is too large";
        }
    }
    else{
        $msg = "Worng file format";
    }
}

 if (!mysql_query($query,$link))
  {
  die('Error: Error in Registration,try later ' . mysql_error());
  }

上传单个文件时,重复多个文件的代码以及文件名。您还可以使用一个数组作为名称,并通过该数组循环上载文件。您可以显示您现在使用的php代码吗?向我们显示表单并不能让我们了解您在服务器端做什么。Serkfalcon请检查上面的代码