Click here to Skip to main content
15,902,189 members
Please Sign up or sign in to vote.
2.00/5 (2 votes)
See more:
How to Insert and retrieve video files into database using asp.net (c#)and then play it on .aspx page ?
if someine know then please send me code. or suggest some idea.
thanks.
Posted

better to store the files on a harddrive and store path and filename in the database. 1.4GB in 1 field in a db for a movie is not advisable.
 
Share this answer
 
Comments
indrish 5-Oct-11 7:57am    
ok but i don't know how to retrive video file from sql database and use on aspx page
Use simple Insert Retrieval methods of Sql. Just save the filename of video in database.

For saving video on server try this...
C#
String guid = Guid.NewGuid().ToString();
String path = Server.MapPath("~/Vids/") + guid;
String fn = FileUpload1.FileName;
//Save this filename in database//
String filename = guid + fn.Substring(fn.LastIndexOf('.'));
//this saves file on server Vids folder// make sure it exists first
FileUpload1.PostedFile.SaveAs(path);


After all this you have to play video. For that either use silverlight mediaplayer(rad) or the easier option use the embed keyword as...

<embed src="path" autoplay="false" showcontrols="true"></embed> 



more info on embed ...HTML EMBED - HTML Code Tutorial[^]

Hope it helps...
 
Share this answer
 
You can Use Flowplayer for playing the retrieved video:



XML
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <style type="text/css">
        body
        {
            font-family: Arial;
            font-size: 10pt;
        }
    </style>
</head>
<body>
    <form id="form1" runat="server">
    <asp:FileUpload ID="FileUpload1" runat="server" />
    <asp:Button ID="btnUpload" runat="server" Text="Upload" OnClick="btnUpload_Click" />
    <hr />
    <asp:DataList ID="DataList1" Visible="true" runat="server" AutoGenerateColumns="false"
        RepeatColumns="2" CellSpacing="5">
        <ItemTemplate>
            <u>
                <%# Eval("Name") %></u>
            <hr />
            <a class="player" style="height: 300px; width: 300px; display: block" href='<%# Eval("Id", "FileCS.ashx?Id={0}") %>'>
            </a>
        </ItemTemplate>
    </asp:DataList>
    <script src="FlowPlayer/flowplayer-3.2.12.min.js" type="text/javascript"></script>
    <script type="text/javascript">
        flowplayer("a.player", "FlowPlayer/flowplayer-3.2.16.swf", {
            plugins: {
                pseudo: { url: "FlowPlayer/flowplayer.pseudostreaming-3.2.12.swf" }
            },
            clip: { provider: 'pseudo', autoPlay: false},
        });
    </script>
    </form>
</body>
</html>
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900