When i use RadAsyncUpload and Rad Upload its giving the following error
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: The process cannot access the file because it is being used by another process.
I have pasted the code for your reference.
protected void AsyncUpload1_FileUploaded(object sender, FileUploadedEventArgs e)
{
checkThum.Width = Unit.Pixel(97);
checkThum.Height = Unit.Pixel(60);
if (e.File.FileName.Length <= 150)
{
byte[] imageData = new byte[e.File.InputStream.Length];
using (Stream stream = e.File.InputStream)
{
stream.Read(imageData, 0, (int)e.File.InputStream.Length);
}
checkThum.Visible = true;
checkThum.DataValue = imageData;
}
else
{
checkThum.Visible = false;
}
}
The above is the code where i will read it as bytes and display the image.
protected void Button1_Click(object sender, EventArgs e)
{
if (RadUpload1.UploadedFiles.Count > 0)
{
if (AsyncUpload1.UploadedFiles.Count > 0)
{
AsyncUpload1.TargetFolder = System.Configuration.ConfigurationSettings.AppSettings["NetworkSmallImageUrl"];
UploadedFile ufImage = AsyncUpload1.UploadedFiles[AsyncUpload1.UploadedFiles.Count - 1];
string imgFileNameMaster = DateTime.Now.TimeOfDay.Ticks.ToString() + ufImage.FileName;
string strImgPathMaster = System.Configuration.ConfigurationSettings.AppSettings["NetworkSmallImageUrl"] + imgFileNameMaster;
string FolderPathMaster = Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["NetworkSmallImageUrl"]) + imgFileNameMaster;
new PictureFunctions().IsResizeRadUploadImageWithWhiteBackroundFilled(ufImage, FolderPathMaster, 80, 56);
ViewState["LogoPath"] = strImgPathMaster;
}
}
}
The above is the button click event which is hidden when i choose a file from a Radupload this button1_click will be fired.
Can you guys help me out on this issue.
Microsoft JScript runtime error: Sys.WebForms.PageRequestManagerServerErrorException: The process cannot access the file because it is being used by another process.
I have pasted the code for your reference.
protected void AsyncUpload1_FileUploaded(object sender, FileUploadedEventArgs e)
{
checkThum.Width = Unit.Pixel(97);
checkThum.Height = Unit.Pixel(60);
if (e.File.FileName.Length <= 150)
{
byte[] imageData = new byte[e.File.InputStream.Length];
using (Stream stream = e.File.InputStream)
{
stream.Read(imageData, 0, (int)e.File.InputStream.Length);
}
checkThum.Visible = true;
checkThum.DataValue = imageData;
}
else
{
checkThum.Visible = false;
}
}
The above is the code where i will read it as bytes and display the image.
protected void Button1_Click(object sender, EventArgs e)
{
if (RadUpload1.UploadedFiles.Count > 0)
{
if (AsyncUpload1.UploadedFiles.Count > 0)
{
AsyncUpload1.TargetFolder = System.Configuration.ConfigurationSettings.AppSettings["NetworkSmallImageUrl"];
UploadedFile ufImage = AsyncUpload1.UploadedFiles[AsyncUpload1.UploadedFiles.Count - 1];
string imgFileNameMaster = DateTime.Now.TimeOfDay.Ticks.ToString() + ufImage.FileName;
string strImgPathMaster = System.Configuration.ConfigurationSettings.AppSettings["NetworkSmallImageUrl"] + imgFileNameMaster;
string FolderPathMaster = Server.MapPath(System.Configuration.ConfigurationSettings.AppSettings["NetworkSmallImageUrl"]) + imgFileNameMaster;
new PictureFunctions().IsResizeRadUploadImageWithWhiteBackroundFilled(ufImage, FolderPathMaster, 80, 56);
ViewState["LogoPath"] = strImgPathMaster;
}
}
}
The above is the button click event which is hidden when i choose a file from a Radupload this button1_click will be fired.
Can you guys help me out on this issue.