function RRUplaod() { var File; File = $('#FileUpload')[0].files[0]; if (File != "") { var fileName = File.name; fileName = fileName + '^' + id var xhr = new XMLHttpRequest(); var url = //service url xhr.open('POST', url, true); xhr.setRequestHeader("FN", fileName); inviteFileName = fileName; xhr.onreadystatechange = function () { }; xhr.send(File); }
public UploadedFile UplaodFile(Stream Uploading) { IncomingWebRequestContext woc = WebOperationContext.Current.IncomingRequest; WebHeaderCollection headers = woc.Headers; string fileName = ""; string id= ""; fileName = headers["FN"].Split('^')[0]; id= headers["FN"].Split('^')[1]; UploadedFile upload = new UploadedFile { FilePath = Path.Combine(HttpContext.Current.Server.MapPath(".") + "\\Document\\", fileName) }; FileStream fs = new FileStream(upload.FilePath, FileMode.Open, FileAccess.Read); byte[] ImageData = new byte[fs.Length]; fs.Read(ImageData, 0, System.Convert.ToInt32(fs.Length)); fs.Close(); }
Quote:You can use: C# File.WriteAllBytes("Foo.txt", arrBytes); // Requires System.IO If you have an enumerable and not an array, you can use: C# File.WriteAllBytes("Foo.txt", arrBytes.ToArray()); // Requires System.Linq
File.WriteAllBytes("Foo.txt", arrBytes); // Requires System.IO
File.WriteAllBytes("Foo.txt", arrBytes.ToArray()); // Requires System.Linq
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)