By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
429,313 Members | 2,798 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 429,313 IT Pros & Developers. It's quick & easy.

Convert binary64 into "avi"

P: n/a
Hello, I'm developing an application using C# as main language,
InfoPath as Input for a XML file and a Web Service in c# to deal with
the XML file generated by InfoPath and then convert it into another
different and customized XML file which I will used from a web
application in C#

The problem:
In InfoPath I have a field as "file attachment", I click on it, attach
the a video in "avi" format and submit it to a Web Service. XML file is
generated and the video "avi" is converted well to binary64. Now I want
to convert this binary64 into avi again using C#

does anybody know how to deal with it??

thanks in adavance

nacho

Dec 13 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Hi,

I'm not sure if this is what you require. Take a look at it and maybe
give it a try.

private bool encoding_Base64(string filename, string file)
{
BinaryWriter binaryWriter;
FileStream fileStream;
string[] lines;

bool flag;

flag = true;
lines = file.Split(Environment.NewLine.ToCharArray());
try
{
fileStream = new FileStream(@filename, FileMode.CreateNew);
binaryWriter = new BinaryWriter(fileStream);
foreach(string line in lines)
binaryWriter.Write(Convert.FromBase64String(line)) ;

binaryWriter.Close();
} // end try statement
catch
{
flag = false;
} // end catch statement

return flag;
}

Dec 13 '05 #2

P: n/a
nacho <na*********@gmail.com> wrote:
Hello, I'm developing an application using C# as main language,
InfoPath as Input for a XML file and a Web Service in c# to deal with
the XML file generated by InfoPath and then convert it into another
different and customized XML file which I will used from a web
application in C#

The problem:
In InfoPath I have a field as "file attachment", I click on it, attach
the a video in "avi" format and submit it to a Web Service. XML file is
generated and the video "avi" is converted well to binary64. Now I want
to convert this binary64 into avi again using C#

does anybody know how to deal with it??


Convert.FromBase64String will give you the data in binary format.
However, it's likely to be rather large - you might wish to consider
streaming it with a CryptoStream using a FromBase64Transform.

--
Jon Skeet - <sk***@pobox.com>
http://www.pobox.com/~skeet Blog: http://www.msmvps.com/jon.skeet
If replying to the group, please do not mail me too
Dec 13 '05 #3

P: n/a
Thanks a lot to you two, I'm going to try and tell you later the
results
cheers!

nacho

Dec 13 '05 #4

P: n/a
The script works well, thanks Curious, it converts well the binary64 to
avi.

The problem now is that InfoPath adds some text at the begining of the
"avi".
The Web Service renames and reallocates the "avi" file.
Lets say I have a file called "testOne.avi" which is the one to be
attached in the InfoPath form, then I click submit, the Web Service
takes "testOne.avi" in binary64 from the XML passed to it and generates
and reallocates the new "avi" file. Well, the new "avi" file already in
the hard drive is 1kb bigger than the original because the following
text was added by InfoPath on the header.

"«IFA   t e s t O n e . a v i "

this bit of text does not allow me to open it.

Well, just to let you know what happend and how InfoPath behaves with
me. There might be a way of getting rid of this.... I will try to find
out.

I'm going to try the CryptoStream now, I might require if my videos are
big. Cheers Jon.

Thanks again

Nacho

Dec 13 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.