| | |
| | | using System.Web.Http; |
| | | |
| | | namespace HH.WCS.Mobox3.AnGang.api { |
| | | |
| | | //[RoutePrefix("api/image")] |
| | | public class ImageController : ApiController { |
| | | //private readonly string _baseStoragePath = HttpContext.Current.Server.MapPath("~/StaticStorage"); |
| | | private readonly string _baseStoragePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "StaticStorage"); |
| | | private readonly string[] _allowedExtensions = { ".jpg", ".jpeg", ".png", ".gif", ".bmp" }; |
| | | |
| | | // 上传图片接口 |
| | | [HttpPost] |
| | | //[ActionName("Upload")] |
| | | //[Route("api/image/upload")] |
| | | [Route("UploadImage")] |
| | | public HttpResponseMessage UploadImage() { |
| | | try { |
| | |
| | | |
| | | // 获取图片接口 - 实际由静态文件处理,这里只是示例 |
| | | [HttpGet] |
| | | //[ActionName("Get")] |
| | | [Route("static/image/{year}/{month}/{day}/{filename}")] |
| | | public HttpResponseMessage GetImage(string year, string month, string day, string filename) { |
| | | try { |