c# - Endpoint which accepts a HttpPostedFileBase and writes the incoming stream to a Webclient for upload -


i have endpoint accepts httppostedfilebase, provides input stream can read download file. don't want read - want re-post endpoint on different domain (this because api built on top of another).

can without waiting whole stream read? don't want users of endpoint delayed unnecessarily.

public actionresult upload(httppostedfilebase image)     string url = "www.example.com";      using (var wb = new webclient())     {         var stream = wb.openwrite(url, "post");         int read;         byte[] buffer = new byte[0x1000];         while ((read = image.inputstream.read(buffer, 0, buffer.length)) > 0)              stream.write(buffer, 0, read);     } } 

unfortunately using openwrite doesn't seem provide easy option read response, i'll buffer entire stream , use uploaddata :(.


Comments

Popular posts from this blog

c++ - OpenCV Error: Assertion failed <scn == 3 ::scn == 4> in unknown function, -

php - render data via PDO::FETCH_FUNC vs loop -

The canvas has been tainted by cross-origin data in chrome only -