Some process seems to be locking the uploaded file, so we cannot move/delete the uploaded file. Is there a way around this?
<%@ Control Language="C#" AutoEventWireup="true" CodeFile="TestAjax.ascx.cs" Inherits="TestAjax" %>
<MagicAjax:AjaxPanel runat="server" ID="MagicAjax1" AjaxCallConnection="Asynchronous">
<asp:Button runat="server" ID="UploaderInsertButton" Text="Upload file" />
<asp:Panel runat="server" ID="UploaderProgressPanel">
<asp:Label ID="UploaderProgressTextLabel" runat="server" />
</asp:Panel>
<CuteWebUI:Uploader runat="server" ID="Uploader1" InsertButtonID='UploaderInsertButton'
ProgressCtrlID='UploaderProgressPanel' ProgressTextID='UploaderProgressTextLabel'
OnFileUploaded="Uploader1_FileUploaded">
</CuteWebUI:Uploader>
</MagicAjax:AjaxPanel>
public partial class TestAjax : UserControl
{
protected void Uploader1_FileUploaded(object sender, UploaderEventArgs file)
{
// Safe uploaded file
string targetFileName = String.Format("{0}/{1}", Constants.FilePathUpload, file.FileName);
file.MoveTo(Path.Combine(Constants.FilePathUpload, targetFileName));
}
}