CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 3 of 3
  1. #1
    Join Date
    Feb 2005
    Location
    Texas, U.S.A
    Posts
    81

    Unhappy Webservice not saving PDF file properly

    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.

  2. #2
    Join Date
    Sep 2004
    Posts
    247

    Re: Webservice not saving PDF file properly

    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.
    Last edited by Davey; February 8th, 2005 at 04:01 PM.

  3. #3
    Join Date
    Feb 2005
    Location
    Texas, U.S.A
    Posts
    81

    Talking Re: Webservice not saving PDF file properly

    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.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  





Click Here to Expand Forum to Full Width

Featured