0

Hi,

I am trying to insert to insert a video into a folder and its path into the database.
But both the things are not working for me.
And also I need to retrieve the video from database.
Can someone help me where i went wrong.
My html to upload video is

<form action="" method="post" enctype="multipart/form-data">
<div class="form_search">
<label>Upload Video Profile:</label>
<span class="form_input">
<input type="file" name="uploadvideo"  />
</span>
</div>

<div class="form_search">
<label> &nbsp;</label>
<span class="form_input">
<input type="submit" name="submitdetails" value="Upload" class="button"/>
</span>
</div>
</form>

and my php code to store the video in a folder named "company_profile" is

<?php
if(isset($_POST['submitdetails']))
{
    $name=$_FILES['uploadvideo']['name'];
    $type=$_FILES['uploadvideo']['type'];
    //$size=$_FILES['uploadvideo']['size'];
    $cname=str_replace(" ","_",$name);
    $tmp_name=$_FILES['uploadvideo']['tmp_name'];
    $target_path="company_profile/";
    $target_path=$target_path.basename($cname);
    if(move_uploaded_file($_FILES['uploadvideo']['tmp_name'],$target_path))
    {
        echo "hi";
        echo "Your video ".$cname." has been successfully uploaded";
    }
}

?>

Please help me how i can store the video file and retrieve it

Edited by muktapuram

3
Contributors
4
Replies
35
Views
4 Years
Discussion Span
Last Post by diafol
0

Your code seems ok.
You can try the following:

  • Open your php.ini file.
  • Make a backup of that file.
  • Find the term "post_max_size" > Change this value to something higher (than the file you are uploading)
  • Find the term "upload_max_filesize" > Change this value to something higher
  • Save the file and Restart your webservice.

Now try uploading your file again. Hope this works (at least I did this when it happened to me).

0

Thanks for ur reply , but my file is only 7mb of size.
is it required to modify php.ini
Anyway i am going to try that now.

Edited by muktapuram

1

Have you considered hosting the video on a service like YouTube or Vimeo? General servers are pretty poor at delivering video, especially if you have a lot of visitors. You then just need to store the unique id in the DB and build the iframe code with that id - quite simple.

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.