Quantcast
Channel: WE MOVED to github.com/microsoft/cpprestsdk. This site is not monitored!
Viewing all articles
Browse latest Browse all 4845

New Post: access image file from the server side (http_listener) .

$
0
0
i am trying to access the data of an image file uploaded by a client .
here is the code .
auto data = req.extract_vector().get();
FILE* out = NULL;
if(!(out = fopen("a.jpg","wb+")))
    return false;
fwrite(&data[0],1,data.size()*sizeof(uchar),out);
fclose(out);

but the uploaded file is not a valid image file .
here is the client code ( in C# if it helps ) .
                    WebClient client = new WebClient();
                    Uri uri = new Uri(@"http://localhost:8085");
                    byte[] ret = client.UploadFile(uri, "C:\\a.jpg");
                    Console.WriteLine(ret.ToString());

Viewing all articles
Browse latest Browse all 4845

Trending Articles