I wrote this:
protected void btnup_Click(object sender, EventArgs e)
{
if (ASPxUploadControl1.HasFile)
{
try
{
string filename = Path.GetFileName(ASPxUploadControl1.FileName);
ASPxUploadControl1.SaveAs(Server.MapPath("upload/") + filename);
StatusLabel.Text = "Upload status: File uploaded!";
}
catch (Exception ex)
{
StatusLabel.Text = "Upload status: The file could not be uploaded. The following error occured: " + ex.Message;
}
}
}
Problem is, if I already have File1.jpg, it will overwrite it if someone else uploads File1.jpg.
What to do here?
Here what you can do to make the file name unique on server to avoid overwrites.