java - 在“在线编辑器”中需要显示该图片,如何获取该图片的以http://开头的url路径
阿神
阿神 2017-04-18 09:43:27
0
1
364
用FileUpload将图片上传到服务器上之后,在“在线编辑器”中需要显示该图片,
要用到该图片的以http://开头的url路径,如何获取该图片的服务器地址
    result.put("err", "");
    //如何获取上传地址路径?
    result.put("msg","上传地址");
    
    renderJson(result);
阿神
阿神

闭关修行中......

reply all(1)
大家讲道理

If the upload directory is on the same server as the page, just pass the relative address, and the browser will parse it by itself. For example, your upload directory is webroot/upload ,那么回传时以 webroot 目录为 / 向后拼接,如 /upload/test.jpg.

If it is not the same server, add the domain name of the upload server at the beginning. You can omit the url protocol, and the browser will judge it by itself. Such as //static.site.com/upload/test.jpg

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template