title: PHP Upload - how to get the relative path of an uploaded file?
body: <p>I have my videos in a folder on my desktop:</p>
  
  <pre><code>/home/john/Desktop/Samples/Vids/small.mp4
  </code></pre>
  
  <p>How can I get this file path from upload or other ways?</p>
  
  <p>This is my html form:</p>
  
  <pre><code>&lt;form class="form-submission" method="post" action="upload.php" enctype= "multipart/form-data"&gt;
          &lt;input type="file" name="upload[]" id="input-file" multiple required&gt;
          &lt;button type="submit" class="btn btn-default no-gradient"&gt;Submit&lt;/button&gt;
  &lt;/form&gt;
  </code></pre>
  
  <p>upload.php:</p>
  
  <pre><code>&lt;?php
  print_r($_FILES);
  </code></pre>
  
  <p>Result:</p>
  
  <pre><code>Array
  (
      [upload] =&gt; Array
          (
              [name] =&gt; Array
                  (
                      [0] =&gt; small.mp4
                  )
  
              [type] =&gt; Array
                  (
                      [0] =&gt; video/mp4
                  )
  
              [tmp_name] =&gt; Array
                  (
                      [0] =&gt; /tmp/php1KNwas
                  )
  
              [error] =&gt; Array
                  (
                      [0] =&gt; 0
                  )
  
              [size] =&gt; Array
                  (
                      [0] =&gt; 383631
                  )
  
          )
  
  )
  </code></pre>
  
  <p>But there is no info of the path - <code>/home/john/Desktop/Samples/Vids/small.mp4</code></p>
  
  <p>Any ideas how can I get it?</p>
  
  <p>I need to find the video file path so I can send it to my youtube channel:</p>
  
  <pre><code>// REPLACE this value with the path to the file you are uploading.
  $videoPath = "/home/john/Desktop/Samples/Vids/small.mp4";
  
  ....
  
  $media-&gt;setFileSize(filesize($videoPath));
  
  
  // Read the media file and upload it chunk by chunk.
  $status = false;
  $handle = fopen($videoPath, "rb");
  while (!$status &amp;&amp; !feof($handle)) {
    $chunk = fread($handle, $chunkSizeBytes);
    $status = $media-&gt;nextChunk($chunk);
  }
  </code></pre>
  
  <p>The entire video uploading code is from <a href="https://developers.google.com/youtube/v3/code_samples/php#upload_a_video" rel="nofollow">google's</a>.</p>