Click here to Skip to main content
15,891,976 members
Please Sign up or sign in to vote.
2.00/5 (1 vote)
See more:
Error occurred while uploading image, the error is

Access to the path 'D:\inetpub\vhosts\image\abcd1.jpg' is denied.

How to rectify this error. please help me out of this error...
Posted
Comments
Sergey Alexandrovich Kryukov 27-Feb-12 18:08pm    
How did you refer this file in your application? What's the site's base path?
--SA

Make sure that the account that the site's app pool is using has the correct access rights to the folder (especially when writing data to the file system)
 
Share this answer
 
v2
Just right click on image folder and remove read only and click apply
 
Share this answer
 
check you image folder is read-only .... ?

put your code .... to review what is the problem
 
Share this answer
 
Comments
sudheerbadboy 27-Feb-12 8:09am    
protected void sub1_Click(object sender, EventArgs e)
{
if (img1.HasFile)
{
string _fileExt1 = System.IO.Path.GetExtension(img1.FileName);
if (_fileExt1.ToLower() == ".gif" || _fileExt1.ToLower() == ".jpeg" || _fileExt1.ToLower() == ".jpg" || _fileExt1.ToLower() == ".png" || _fileExt1.ToLower() == ".bmp")
{
img1.SaveAs(MapPath("../image/" + img1.FileName.Replace(img1.FileName, txtname.Text + "1" + _fileExt1)));
}
conn.Open();
SqlCommand cmd = new SqlCommand();
cmd = new SqlCommand("update cuedetails set price='" + txtprice.Text + "', weight='" + txtweight.Text + "',length='" + txtlength.Text + "',joint='" + txtjoint.Text + "',shaft='" + txtshaft.Text + "',wrap='" + txtwrap.Text + "',comments='" + txtComments.Text + "',image1='image/" + txtname.Text + "1" + _fileExt1 + "',image2='" + lblimg2.Text + "',image3='" + lblimg3.Text + "',image4='" + lblimg4.Text + "',status='YES' where brand='" + ddlbrand.SelectedItem.Text + "' and name='" + ddlname.SelectedItem.Text + "'", conn);
int result = cmd.ExecuteNonQuery();
if (result > 0)
{
this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Data Inserted Successfully..!.');", true);

}
else
{
this.ClientScript.RegisterStartupScript(this.GetType(), "alert", "alert('Data Inserted failed..!.');", true);

}
conn.Close();

}
}
sudheerbadboy 27-Feb-12 8:09am    
above is my code...

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900