上傳後自動播放視頻,我只試過這種簡單的上傳如何使用ASPX C#
的Default.aspx:
<AjaxControlToolkit:AsyncFileUpload ID="AsyncFileUpload1" runat="server" CompleteBackColor="White"
OnUploadedComplete="AsyncFileUpload1_UploadedComplete" OnUploadedFileError="AsyncFileUpload1_UploadedFileError"
OnClientUploadComplete="Success" OnClientUploadError="Error" />
<br />
<asp:Button runat="server" ID="btnUpload" Text="Upload" Width="84px"/>
<asp:Label ID="Label1" runat="server"></asp:Label>
Default.aspx.cs:
protected void AsyncFileUpload1_UploadedComplete(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
{
//Fired on the server side when the file successfully uploaded
if (AsyncFileUpload1.HasFile)
{
AsyncFileUpload1.SaveAs(@"C:\Images\" + AsyncFileUpload1.FileName);
Label1.Text = "Received " + AsyncFileUpload1.FileName + " Content Type " + AsyncFileUpload1.PostedFile.ContentType;
}
}
protected void AsyncFileUpload1_UploadedFileError(object sender, AjaxControlToolkit.AsyncFileUploadEventArgs e)
{
Label1.Text = "Error!!";
//Fired on the server side when the loaded file is corrupted
//Display some error message here
}
你有任何soln: - | –