I am getting following exception while trying to add a file :
SPException: It may refer to a nonexistent file or folder, or refer to a valid file or folder that is not in the current Web.
Code for uploading :
spFile = spWeb.Files.Add( docUrl, uploadStream, true, // overwrite or add a new version uploadMessage.Metadata.CheckInComment ?? "", //check-in comment to use when creating the file in the collection. (can't be NULL) false); // don't check the required fields when saving the file
The issue does not occur while manually uploading the file from the browser but while adding the file in a Document Library from the code using SPWeb.Files.Add the above mentioned exception occurs. Please note that the Content DB of the web application is not full.