Implement file upload with Web Services service

xiaoxiao2021-03-06  115

Create a web services service,

Public string UploadFile (byte [] fs, string filename)

{

Try

{

/// Define and instantiate a memory stream to store an array of bytes submitted.

MemoryStream M = New MemoryStream (fs);

// / Define the actual file object and save the uploaded file.

FILESTREAM F = New FileStream (Server.mAppath (") " // "

FileName, FileMode.create;

/// Write the data in the inner memory into physical files

M.Writto (f);

m.Close ();

f.close ();

f = NULL;

m = NULL;

The return "file has been uploaded.";

}

Catch (Exception EX)

{

Return ex.Message;

}

}

转载请注明原文地址:https://www.9cbs.com/read-99118.html

New Post(0)