WCF Restful service file upload with multi-platform support

can anybody please tell me how can i create a WCF Rest service through which i can be abel to upload files to server using android , iphone & WP7.

Answers


Thanks for help I was able to create file upload wcf rest service for multiple platform.

public void FileUpload(string fileName, Stream fileStream)
{
    FileStream fileToupload = new FileStream("c:\\FileUpload\\" + fileName, FileMode.Create);

    byte[] bytearray = new byte[10000];
    int bytesRead, totalBytesRead = 0;
    do
    {
        bytesRead = fileStream.Read(bytearray, 0, bytearray.Length);
        totalBytesRead += bytesRead;
    } while (bytesRead > 0);

    fileToupload.Write(bytearray, 0, bytearray.Length);
    fileToupload.Close();
    fileToupload.Dispose();
}

[ServiceContract]
public interface IImageUpload
{
    [OperationContract]
    [WebInvoke(Method = "POST", UriTemplate = "FileUpload/{fileName}")]
    void FileUpload(string fileName, Stream fileStream); 
}

Any Rest service can be accessed using Android, iphone and WP7.

One option is to create a Rest POST service using WCF or MVC and get the image in data as base64 string.


Need Your Help

is "this" as a param a reference?

c# reference xna

I am developing a level editor in Xna and my question is that when you call a method using "this" as a param is the param a reference or a value?

Oracle CLOB performance

performance oracle spring jdbc lob

I am running queries against an Oracle 10g with JDBC (using the latest drivers and UCP as DataSource) in order to retrieve CLOBs (avg. 20k characters). However the performance seems to be pretty ba...