i want to upload and then move a video to a directory i just created. Instead of moving the video to /var/www/html/ProductVideos/[email protected] it sends the video to /var/www/html/ProductVideos/
It works if i make $location = "/var/www/html/ProductVideos/[email protected]" but the location will change so i am trying to make the PHP script dynamic
ProductAccountName = [email protected]
PHP code:
<?php
$ProductAccountName = $_POST['ProductAccountName'];
$NewDirectory = "/var/www/html/ProductVideos/" . $ProductAccountName;
if (!file_exists($NewDirectory))
{
mkdir($NewDirectory, 0777, true);
}
if($_SERVER['REQUEST_METHOD']=='POST'){
$file_name = $_FILES['myFile']['name'];
$file_size = $_FILES['myFile']['size'];
$file_type = $_FILES['myFile']['type'];
$temp_name = $_FILES['myFile']['tmp_name'];
$location = $NewDirectory . $file_name; //"/var/www/html/ProductVideos/$ProductAccountName/" . $file_name;
move_uploaded_file($temp_name, $location);

