how to retrieve video files of different types from App_data/videos folder. .i am using webmatrix3. RRS feed

  • Question

  • User1493762548 posted
    video upload code is here file uploads successfully.
    fileName = ""; if (IsPost) { var fileSavePath = ""; var uploadedFile = Request.Files[0]; fileName = Path.GetFileName(uploadedFile.FileName); if (fileName!=myfile){ fileSavePath = Server.MapPath("~/App_Data/Videos/" + fileName); uploadedFile.SaveAs(fileSavePath); var insertCommand = "INSERT INTO Products (fileName) Values(@0)"; db.Execute(insertCommand, fileName); }
    file retrieve code is here.

        var ProductId = Request["Id"];
      // var ProductId = UrlData[0].AsInt();
        var db = Database.Open("PhotoGallery");
        var p = db.QuerySingle("SELECT * FROM Products WHERE ProductId = @0", ProductId);
        var fileName= p.fileName;
         if (p == null)
       var  filePath = Server.MapPath("~/App_Data/Videos/" +
    <!DOCTYPE html>
        <title>Flash Video</title>
        @Video.Flash(path:" @filePath", 
                     width: "400",
                     height: "600",
                     play: true,
                     loop: true,
                     menu:  false,
                     bgColor: "red",
                     quality: "medium",
                     scale: "exactfit",
                     windowMode: "transparent")
    the error is :
    System.InvalidOperationException: The media file " @filePath" does not exist
    Line 29:     @Video.Flash(path:" @filePath", 

    i think there is problem with file type . i uploaded file of mp4 and retrieve swf file. i am using webmatrix3 please help to upload video file
    any type and retrieve
    i need the code or link.thanks in advance.

    Wednesday, March 30, 2016 8:35 AM


  • User-821857111 posted

    @Video.Flash(path:" @filePath",

    If you want to pass a variable, you shouldn't enclose it in quotes otherwise it becomes a literal string

    @Video.Flash(path: filePath,

    However, even then it will not work because the Video.Flash method expects a swf file and you cannot serve files directly from App_Data.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, April 1, 2016 3:09 PM

All replies