Click to See Complete Forum and Search --> : Webservice not saving PDF file properly


checksal
February 8th, 2005, 11:34 AM
I an working on uploading PDF files using VBS and .net c# webservice. I am converting the PDF to base64 on the vbs side and then reconverting on the server and saving. But when I try to open the files, they are empty. The following is the code used on the webservice.

//fileData is the base64 coming from the VBS
byte[] bb = System.Convert.FromBase64String(fileData);
System.IO.MemoryStream bs = new System.IO.MemoryStream(bb);
FileStream fs = new FileStream(@"C:\"+filename,FileMode.OpenOrCreate,FileAccess.Write);
fs.Close();

Please help because it is hard for a newbie like me. I do not know why the files are empty. Its baffling.

Davey
February 8th, 2005, 02:59 PM
You don't appear to be writing anything to the FileStream object.

Have a look at the FileStream.Write method - this should let you write the MemoryStream out to the file.

checksal
February 8th, 2005, 04:53 PM
Thanks Davey but the problem was on the VBS side. The c# side was also much more complex since it had to do with manupilation at the soapextention level. But the issue is solved. It was much more complex than what I was doing earlier. Thanks for everyone who helped.