0

嗨,我在 index.php 中有以下表格

  <form action="file1.php?arg=<?php echo $id ?>"
    class="dropzone"
    id="my-awesome-dropzone">
  </form>

同样在 index.php 我有

  if ( !isset($_SESSION['logged-in']) || $_SESSION['logged-in'] !== true) {
    header('Location: file.php');
    exit;
  }

file1.php如下

  $ds = DIRECTORY_SEPARATOR;  //1
  $storeFolder = 'dir'.$id;   //2
  if (!empty($_FILES)) {
    $tempFile = $_FILES['file']['tmp_name'];          //3              
    $targetPath = dirname( __FILE__ ) . $ds. $storeFolder . $ds;  //4
    $targetFile =  $targetPath. $_FILES['file']['name'];  //5
    move_uploaded_file($tempFile,$targetFile); //6
  }

move_uploaded_file 完成后如何重定向到 mytest.php 文件?

提前谢谢

4

1 回答 1

0
$ds = DIRECTORY_SEPARATOR;  //1
$storeFolder = 'dir'.$id;   //2

if (!empty($_FILES)) {
    $tempFile = $_FILES['file']['tmp_name'];          //3              
    $targetPath = dirname( __FILE__ ) . $ds. $storeFolder . $ds;  //4
    $targetFile =  $targetPath. $_FILES['file']['name'];  //5
    $status = move_uploaded_file($tempFile,$targetFile); //6

    if($status){ // If it return's true on SUCCESS
        header('Location: mytest.php');
        exit;
    }

}
于 2013-05-12T19:19:40.490 回答