<?php

$uploads_dir = '../../assets/glb/Revit元件/'; //Directory to save the file that comes from client application.

if(isset($_POST["filepath"])){
    $filepath = $_POST["filepath"];
    $filename = $_POST["filename"];
    
    $originalFilepath = $uploads_dir.$filename;
    $destinationFilepath = $uploads_dir.$filepath."/".$filename;
    rename($originalFilepath, $destinationFilepath);

}else if ($_FILES["file"]["error"] == UPLOAD_ERR_OK) {
    $tmp_name = $_FILES["file"]["tmp_name"];
    $name = $_FILES["file"]["name"];
    move_uploaded_file($tmp_name, "$uploads_dir/$name");
}
?>
