This is a migrated thread and some comments may be shown as answers.

The process cannot access the file because it is being used by another process

1 Answer 82 Views
AsyncUpload
This is a migrated thread and some comments may be shown as answers.
md
Top achievements
Rank 1
md asked on 26 Aug 2011, 12:05 PM
Hi,
 Iam trying to save the uploaded image into database and also into folder in my project.Problem is that not able to save image into folder
error:The process cannot access the file because it is being used by another process

protected void RadGrid_Insert(object sender, GridCommandEventArgs e)

{

 

GridEditFormInsertItem InsertItem = e.Item as GridEditFormInsertItem;

try 
{

 

string Name = (InsertItem.FindControl("txbName") as TextBox).Text;

string Address = (InsertItem.FindControl("txtAddress") as TextBox).Text;

string ContactPerson = (InsertItem.FindControl("txtContactPerson") as TextBox).Text;

int PhoneNumber = int.Parse((InsertItem.FindControl("txtPhoneNumber") as TextBox).Text);

 

string EmailID = (InsertItem.FindControl("txtEmail") as TextBox).Text;

RadAsyncUpload radAsyncUpload = InsertItem.FindControl("AsyncUpload1") as RadAsyncUpload;

UploadedFile file = radAsyncUpload.UploadedFiles[0];

string s = file.FileName;

string path = "images/"; 

 

byte[] fileData = new byte[file.InputStream.Length];

file.InputStream.Read(fileData, 0, (

int)file.InputStream.Length);

 

UploadedFile file1 = radAsyncUpload.UploadedFiles[0];

file1.SaveAs(Server.MapPath(path+s));

1 Answer, 1 is accepted

Sort by
0
Jayesh Goyani
Top achievements
Rank 2
answered on 28 Aug 2011, 11:04 AM
Hello,

Please go to the image folder's property and uncheck readonly


Thanks,
Jayesh Goyani
Tags
AsyncUpload
Asked by
md
Top achievements
Rank 1
Answers by
Jayesh Goyani
Top achievements
Rank 2
Share this question
or