0

I have my videos in a folder on my desktop:

/home/john/Desktop/Samples/Vids/small.mp4

How can I get this file path from upload or other ways?

This is my html form:

<form class="form-submission" method="post" action="upload.php" enctype= "multipart/form-data">
        <input type="file" name="upload[]" id="input-file" multiple required>
        <button type="submit" class="btn btn-default no-gradient">Submit</button>
</form>

upload.php:

<?php
print_r($_FILES);

Result:

Array
(
    [upload] => Array
        (
            [name] => Array
                (
                    [0] => small.mp4
                )

            [type] => Array
                (
                    [0] => video/mp4
                )

            [tmp_name] => Array
                (
                    [0] => /tmp/php1KNwas
                )

            [error] => Array
                (
                    [0] => 0
                )

            [size] => Array
                (
                    [0] => 383631
                )

        )

)

But there is no info of the path - /home/john/Desktop/Samples/Vids/small.mp4

Any ideas how can I get it?

I need to find the video file path so I can send it to my youtube channel:

// REPLACE this value with the path to the file you are uploading.
$videoPath = "/home/john/Desktop/Samples/Vids/small.mp4";

....

$media->setFileSize(filesize($videoPath));


// Read the media file and upload it chunk by chunk.
$status = false;
$handle = fopen($videoPath, "rb");
while (!$status && !feof($handle)) {
  $chunk = fread($handle, $chunkSizeBytes);
  $status = $media->nextChunk($chunk);
}

The entire video uploading code is from google's.

Run
  • 54,938
  • 169
  • 450
  • 748
  • You don't need the client real path. You have the file (server side) -> /tmp/php1KNwas ! – Ismail RBOUH Jul 09 '16 at 06:57
  • Plus the client does not send it, as you can see if you dump the HTTP headers, see https://stackoverflow.com/questions/8659808/how-does-http-file-upload-work#8660740 for an example dump. And even Jascript does not let you access this via the input attributes. So this seems impossible to me. – Thomas P. Jul 09 '16 at 07:01
  • @IsmailRBOUH I need the path bcos PHP upload won't let me upload any video more than 7MB in the upload_max_filesize directive in php.ini... – Run Jul 09 '16 at 07:05
  • 1
    So you need it in order to access the file directly on your disk !! This is not possible. Either you change the 'upload_max_filesize' or you enter the file path manually, assuming you are on the same machine without any access restrictions ! – Ismail RBOUH Jul 09 '16 at 07:11
  • Aww ok. I think I have to `enter the file path manually`! Thanks for the help! – Run Jul 09 '16 at 07:16

0 Answers0