c# - file is saved with zero bytes(0 bytes) -


0 bytes file has been created when I'm trying to change the file in the code behind the C #.
  string fileExactLocation = s + str; If (file.exists (filexactactation) (file. Replay (filexaccactclice, fileex location location, "verve");} and fileUpload1.SaveAs (FileExactLocation);   

In the above code, I'm trying to delete a file located, it is deleted, but the file I am trying to save (replacement) has 0 bytes ... it's empty

Please let me know this Solve the problem ....

I think you are confused whether changes does what you want to do, replace the original file with a new one, just delete the old, otherwise, If you want to backup the original file, then rename it before saving.

So if I understand my understanding, then I think you are either looking for:

 FileExactLocation = s + str; If {File.Exists (FileExactLocation)} {File.Delete (FileExactLocation);} FileUpload1.SaveAs (FileExactLocation);   

Or: < / P> Ring Failaksaktaclais = s + str; Rename the file to add werwe to File File (File.Exists (FileExactLocation)) {// file name file. (Fileexacation location, path.cbon (filexact location, "vera")); } FileUpload1.SaveAs (FileExactLocation);

Comments