I want to create multiple file upload application(Client Object Modal) which upload the multiple document in the specific(selected) document library with the meta data(custom properties in library). is it possible to create application like this type of application ? if it is possible then how ?


Yes. I think you need to use an HTTP PUT to send the file to the server. Then, having sent it, you'll need to retrieve and set it's details using the client object model.

To upload a file, you can use something like:

WebRequest request = WebRequest.Create( "http://somedestination" + "/" + filename);
ICredentials creds;
//Set your credentials
request.Credentials = creds;
request.Method = "PUT";
byte[] buffer = new byte[1024];
using (Stream stream = request.GetRequestStream())
    using (FileStream fs = new FileStream(filepath, FileMode.Open, FileAccess.Read))
        for (int i = fs.Read(buffer, 0, buffer.Length); i > 0; i = fs.Read(buffer, 0, buffer.Length))
            stream.Write(buffer, 0, i);
HttpWebResponse response = (HttpWebResponse)request.GetResponse();

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.