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.