Working on a project that involves people signing up to the website and uploading a video,the thing is i have created a file upload form and it works perfect,i head over to the database and check the users table and i see the video uploaded i then head into my php code and initialize the variable:
$Getvid = " ";
then i fetch the row
while ($row = mysqli_fetch_array($user_query, MYSQLI_ASSOC)) { $vid = $row ["vid"]; }
after that i place
$Getvid = '< source src="user/'.$u.'/'.$vid.'" >';
if($vid == NULL) {
$Getvid = '< source src="image/Movie on 2013-07-24 at 13.43.mov" type="video/mp4" >';
}
to get video files that a user have uploaded and echo it out on he/she page and also if the vid row is null then the script would show a default video that i have stored in the database
after that i echo out the video on the users page
< video width="320" height="240" controls>
< source src="< ?php echo $vid; ? > " >
</video>
but for some reason the video doesn't show also the default doesn't work unless i source it specially like this:
<video width="320" height="240" controls>
<source src="image/Movie on 2013-07-24 at 13.43.mov" type="video/mp4" >
</video>
i really need help i tried googling everything phrase i could thing of and nothing so if anyone could please help me i would appreciate your assistance so much the deadline for my project is creeping up on me and i dont know where to turn next for help...
Two potential sources of the problem, you shouldn't store your files with spaces in their names and you haven't specified a type for your video.
The SRC should contain a valid URL and therefore you should have %20 or + in your PHP string in stead of the spaces.
Note: As mentioned by Fisk, your php tags are wrong due to the spacing. You use the PHP echo short-form by replacing
< ?php echo $vid; ? >
by
<?= $vid; ?>
PHP will not be invoked if you're actually typing < ?php
in the source code. It will need to be in a single tag, such as <?php
. When you have fixed that, compare the output from the PHP code with your working example and see where it differs. If you want a more exact answer on that, add the generated HTML together with the HTML you're expecting to your question.
You're also using the same variable in different paths; one place you're appending image/ before the video name, while your variable doesn't seem to contain the path.