简体   繁体   English

表单操作dropzone.js之后的php重定向

[英]php redirect after form action dropzonejs

Hi I have the below form in index.php 嗨,我在index.php中有以下表格

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

Also in the index.php I have 另外在index.php中,我有

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

The file1.php is as follows 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
  }

How to redirect after move_uploaded_file is completed to mytest.php file? move_uploaded_file完成后如何重定向到mytest.php文件?

Thx in advance 提前Thx

$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;
    }

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM