File transfer

Sep 17, 2015 at 11:37 AM
I need to be able to accept POST-ed files like images from client applications. Is this supported in DbWebApi? If yes, what is the example URL for it?
Oct 8, 2015 at 3:20 AM
Sorry for late reply.
File-upload is not directly supported in DbWebApi.
As an extension to ASP.NET Web Api, DbWebApi just accepts a set of name-value pairs in either POST body (JSON/BSON format only) or GET querystring, binding them to database stored procedure.
I am a bit curious about your detail usage scenarios, would you mind telling me more?
Oct 8, 2015 at 6:22 AM
Hi, tnx for the answer. Basically I am communicating with Oracle database and I have one procedure which is handling insert and one for select of files stored in Oracle BLOB datatype column. So I want to retrive thouse files while calling DbWebApi and of course store them wit another "insert" procedure...
Oct 16, 2015 at 2:01 PM
Hi, did you manage to check how to accomplish this?
Oct 20, 2015 at 3:08 AM
Edited Oct 23, 2015 at 2:47 AM

If I understand your question in the right way, you need to extract file-uploaded data from a Multipart MIME message, then you can pass FileData as some stored procedure parameters to DbWebApi.
  • Below ASP.NET Web API document,-part-2
    shows a demonstration to accomplish this.
  • Alternatively, you can use some third party Multipart Data MediaTypeFormatter for automatic binding action parameters.
    Then you pass all the parameters to DbWebAip straight forward.
    -- I haven't tried anyone of them, so I would also like to know which one are handy after you try them?
Another thing about stored procedure parameters passing through DbWebApi, only CLOB and simple data types have been tested. Would you please let me know if you find any issue with BLOB data type?

Oct 23, 2015 at 2:46 AM
Edited Oct 23, 2015 at 2:47 AM
Hi, During these couple days, the more I think about this requirement, the more it makes sense. To transparently support multipart auto-binding is included in the TODO plan.
Much appreciated for your suggestion.
Oct 28, 2015 at 7:48 PM
Thank you very much for the information and giving me direction. I will study how to send and receive files from Oracle database.

Have one more question, what is the best way to protect API which is disaposed on public url address? Currently I am using basic windows authentication enabeled in web.config, but what about additional encription or API keys on top of windows authentication... Can you give me a recommendation?.
Oct 28, 2015 at 7:51 PM
And of course I will share with you all of my experience in next months when I finish with integration of your API with my mobile application.
Nov 10, 2015 at 3:30 AM
Edited Nov 10, 2015 at 2:55 PM
Hi, since version DbWebApi implemented a self-adaptive InputParameters class for auto-binding all input parameters from HTTP request body. It can recognize json, xml and html forms: application/x-www-form-urlencoded and multipart/form-data (for file upload). All the detail is completely transparent to you. Refer to the example server DbWebApiController at
, Your server side code will be further simpler than before.
Any uploaded file(s) binary data will be bound to the same name parameters of the stored procedure. If db side is a BLOB, the uploaded binary data will be passed in straightforward.

You can obtain the latest DbWebApi packages from NuGet.
Nov 11, 2015 at 6:10 AM
Abel thank you very much. Will try that out and let you know.
Nov 12, 2015 at 5:50 PM
Update for uploaded stream:
  1. If db side is a BLOB or any other binary type (such as Raw, LongRaw, BFile) parameter, the uploaded binary data will be passed in straightforward without any transformation;
  2. If db side is a CLOB/NCLOB or any other string type, the uploaded stream will be treated as UTF-8 encoding to be decoded back to a string, unless your file contains BOM (Byte Order Marks) - it will detect encoding from the BOM. Then pass the string into the stores procedure.