C# web api / Javascript file upload set filename -
i use asp.net web api backend , javascript client. use form input let user select file, , make ajax request web api formdata, this:
var form = $('#uploadform')[0]; var formdata = new formdata(form); $.ajax({ ... type: 'post', data: formdata, ... });
on backend receive request, , data httpcontent object. this:
try { if (!request.content.ismimemultipartcontent("form-data")) { return statuscode(httpstatuscode.unsupportedmediatype); } var result = await _blobrepository.uploadblobs(request.content); if (result != null && result.count > 0) { return ok(result); } return badrequest(); }
i need have unique file names.
how can rename file? not matter if client side, or backend.
wiki
Comments
Post a Comment