This article describes the method of remote uploading of pictures based on Web Service. Share it for your reference, as follows:
Page call code: Prerequisite to add a web reference
HttpFileCollection files = ; string filePath = files[0].FileName; string fileName = (("//") + 1); byte[] datas = new byte[files[0].ContentLength]; fs; web = new (); fs = ()files[0].InputStream; //Read the input stream into a two-dimensional array(datas, 0, files[0].ContentLength); (); ((datas,fileName));
Code in Web Service
[WebMethod(Description="Upload server image information and return whether it is successful")] public string UploadFile(byte[] fs,string fileName) { //Create memory stream Write array into memory stream MemoryStream memory = new MemoryStream(fs); //Write memory stuff into file stream FileStream stream = new FileStream((".") + "//images" + fileName,); //Write the memory stream into the FileStream stream (stream); (); memory = null; stream = null; return "The file upload was successful!"; }
I hope this article will be helpful to everyone's programming.