4 Answers, 1 is accepted
The SaveAs method does not work asynchronously as the files are saved one by one.
Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.
public void Upload(UploadedFile file, string entityValue, string path, string domain, string org, string repNum, string entityType)
file.SaveAs(path); // This save file to local disk successfully
// After above line executes file.inputStrream becomes null and my obj.Upload method fails, how to fix this ?
obj.Upload(file, entityValue, path, domain, org, repNum, entityType);
You need to open a new stream from the new file you just created, the old file (in the temporary folder) is now deleted (that's what file.SaveAs() does) and so its stream should be expected to be null as it does not exist anymore.
An alternative is to use the stream to do the desired operation (e.g., write the files somewhere else, like in a database) and only then call .SaveAs().