I am trying to upload PDF files. Only sometimes uploaded file gets corrupt. When I open that file on Adobe or browser. its says Insufficient data for an images
This problem is not for all the uploads. When I tried to upload the same file again its works perfectly.
I am not able to replicate the issue so that I can know why this type of issue occurring
I am using below code to save the file
FileUpload upload = GridView1.Rows[index].FindControl("FileUpload1") as FileUpload;
if (upload.HasFile)
{
string nameoffile = upload.FileName;
Random ran = new Random();
int forReference = ran.Next();
string[] strfileArray = nameoffile.Split('.');
nameoffile = strfileArray[0] + "" + forReference + ".pdf";
upload.SaveAs(path + "/" + nameoffile);
}
else
{
upload.SaveAs(path + "/" + nameoffile);
}
Note: We are running this appliaction on Azure VM. This code was works without any issue on previous server. since we migrated to Azure
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…