TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Rajat Chaurasia
NA
6
423
Upload and download video
Apr 27 2020 9:25 AM
I put my webform(UserPage.aspx) in a rootfolder named UpdatePage, and I'm Uploading my Videos In different root folder named: UploadedVideos. Everything is working fine. but when I'm retrieving the Path of the video from the sql server and pass it to the video player in the Gridview, it is looking for the video in UpdatePage/UploadVideos/filename.mp4 instead of root folder UploadVideos/Filename.mp4.
How to solve the issue??
Backend code for uploading file and saving path:
if
(fileupload1.HasFile && fileupload1.PostedFile !=
null
&& fileupload1.PostedFile.FileName !=
""
)
{
Bal objBal =
new
Bal();
try
{
string
filename = Path.GetFileName(fileupload1.PostedFile.FileName);
fileupload1.PostedFile.SaveAs(Server.MapPath(
"~/UploadedVideos/"
+ filename));
string
filepathtostore =
string
.Format(
"UploadedVideos/"
+filename);
objBal.VideoFilePath = filepathtostore;
objBal.Description = txtDesc.Text.Trim();
objBal.Course = dropdownlist1.SelectedItem.ToString();
objBal.filetype = dropdownlist2.SelectedItem.ToString();
int
result = objBal.AdminUploadPhysicsVideoBalFunc(objBal);
if
(result>0)
{
labelmsg.Visible =
true
;
labelmsg.ForeColor = System.Drawing.Color.Green;
labelmsg.Text =
"Video File Updated Successfully"
;
}
else
{
labelmsg.Visible =
true
;
labelmsg.ForeColor = System.Drawing.Color.Red;
labelmsg.Text =
"Can't Upload File Try Again."
;
}
BindVideoPanel();
}
catch
(Exception ex)
{
throw
ex;
}
finally
{
objBal =
null
;
}
}
Backend code for binding Gridview::
private
void
BindVideoPanel()
{
DataSet ds =
new
DataSet();
Bal objBal =
new
Bal();
try
{
ds = objBal.BindVideoPanelBalFunc();
VideoGridView.DataSource = ds;
VideoGridView.DataBind();
}
catch
(Exception ex)
{
throw
ex;
}
finally
{
objBal =
null
;
}
}
Frontend HTML :
DataKeyNames="Id" OnPageIndexChanging="VideoGridView_PageIndexChanging" OnRowDeleting="VideoGridView_RowDeleting" AllowPaging="true">
Reply
Answers (
1
)
Dev extreme Date Format Validation Problem
save data in view using store procedure