Reputation: 9378
I have an web application that works fine when uploading pictures but when uploading larger videos to picasa, I sometimes get an error message. Is there a way I can know that the steam is not needed anymore so I can close it (using the keyword "using" or something) thanks for any advice. Error
System.Net.WebException: The request was aborted: The request was canceled. ---> System.IO.IOException: Cannot close stream until all bytes are written.
PicasaEntry entry = service.Insert(postUri, videoEntry);//This is the line that does the call
PhotoAccessor googlePhoto = new PhotoAccessor(entry);
stream.Close();//Fails here
Upvotes: 0
Views: 4999
Reputation: 25684
I'm not sure exactly what type your stream object is, but the base Stream class has a Flush method you can call to force everything in the stream to be written.
stream.Flush();
stream.Close();
Upvotes: 2