New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

文件上传至服务器 #12124

Closed
immotor-bill opened this Issue Jun 22, 2016 · 34 comments

Comments

Projects
None yet
@immotor-bill

immotor-bill commented Jun 22, 2016

不支持图片上传到本地,感觉很不好啊,建议支持

@88250

This comment has been minimized.

Show comment
Hide comment
@88250

88250 Jun 28, 2016

Member

谢谢反馈!后续可能会考虑(如果很多人都需求的话)。

Member

88250 commented Jun 28, 2016

谢谢反馈!后续可能会考虑(如果很多人都需求的话)。

@TiSongWen

This comment has been minimized.

Show comment
Hide comment
@TiSongWen

TiSongWen Jul 16, 2016

现在solo图片上传功能的前提是配置七牛吗?

TiSongWen commented Jul 16, 2016

现在solo图片上传功能的前提是配置七牛吗?

@88250

This comment has been minimized.

Show comment
Hide comment
@88250

88250 Jul 17, 2016

Member

@TiSongWen 是的呢

Member

88250 commented Jul 17, 2016

@TiSongWen 是的呢

@88250 88250 changed the title from solo图片上传支持本地 to solo 文件上传支持本地 Sep 18, 2016

@kkmgc

This comment has been minimized.

Show comment
Hide comment
@kkmgc

kkmgc Sep 18, 2016

建议支持

kkmgc commented Sep 18, 2016

建议支持

@88250

This comment has been minimized.

Show comment
Hide comment
@88250

88250 Sep 18, 2016

Member

@kkmgc 谢谢反馈,还需要再收集一些用户反馈再决定。

Member

88250 commented Sep 18, 2016

@kkmgc 谢谢反馈,还需要再收集一些用户反馈再决定。

@czwer

This comment has been minimized.

Show comment
Hide comment
@czwer

czwer Nov 7, 2016

建议支持本地上传

czwer commented Nov 7, 2016

建议支持本地上传

@88250

This comment has been minimized.

Show comment
Hide comment
@88250

88250 Nov 7, 2016

Member

@czwer 收到,谢谢反馈。

Member

88250 commented Nov 7, 2016

@czwer 收到,谢谢反馈。

@ZhaoYueNing

This comment has been minimized.

Show comment
Hide comment
@ZhaoYueNing

ZhaoYueNing Nov 21, 2016

非常建议 支持 本地上传的功能

ZhaoYueNing commented Nov 21, 2016

非常建议 支持 本地上传的功能

@88250

This comment has been minimized.

Show comment
Hide comment
@88250

88250 Nov 21, 2016

Member

@ZhaoYueNing 收到,谢谢反馈。

Member

88250 commented Nov 21, 2016

@ZhaoYueNing 收到,谢谢反馈。

@zhuwenbing

This comment has been minimized.

Show comment
Hide comment
@zhuwenbing

zhuwenbing Dec 20, 2016

Member

建议支持

Member

zhuwenbing commented Dec 20, 2016

建议支持

@ZephyrJung ZephyrJung self-assigned this Dec 20, 2016

@yhnnhyyhnn

This comment has been minimized.

Show comment
Hide comment
@yhnnhyyhnn

yhnnhyyhnn Dec 27, 2016

应该有很多人希望加上

yhnnhyyhnn commented Dec 27, 2016

应该有很多人希望加上

@88250 88250 added this to the 1.8.0 milestone Dec 27, 2016

@88250 88250 added the feature label Dec 27, 2016

@88250 88250 self-assigned this Dec 27, 2016

@88250 88250 changed the title from solo 文件上传支持本地 to 文件上传至服务器 Dec 27, 2016

@88250

This comment has been minimized.

Show comment
Hide comment
@88250

88250 Jan 22, 2017

Member

1.8 里面暂时不加入了,设计还没有思考清楚:

  • 配置默认上传保存的目录路径在什么地方比较合适
  • 和七牛的配置优先级问题

这两个会加大复杂度,让大家使用时更麻烦,不如直接注册七牛来得快捷。

Member

88250 commented Jan 22, 2017

1.8 里面暂时不加入了,设计还没有思考清楚:

  • 配置默认上传保存的目录路径在什么地方比较合适
  • 和七牛的配置优先级问题

这两个会加大复杂度,让大家使用时更麻烦,不如直接注册七牛来得快捷。

@88250 88250 removed this from the 1.8.0 milestone Jan 22, 2017

@yhnnhyyhnn

This comment has been minimized.

Show comment
Hide comment
@yhnnhyyhnn

yhnnhyyhnn Jan 22, 2017

yhnnhyyhnn commented Jan 22, 2017

@pencilso

This comment has been minimized.

Show comment
Hide comment
@pencilso

pencilso Apr 25, 2017

感觉没有太大的必要上传到服务器本地,如果说万一某一天迁移服务器的话,你还得把图片和数据库打包备份下来。

pencilso commented Apr 25, 2017

感觉没有太大的必要上传到服务器本地,如果说万一某一天迁移服务器的话,你还得把图片和数据库打包备份下来。

@BianJian

This comment has been minimized.

Show comment
Hide comment
@BianJian

BianJian May 2, 2017

商业环境 肯定要有这个选项啊..

BianJian commented May 2, 2017

商业环境 肯定要有这个选项啊..

@githubzaibao

This comment has been minimized.

Show comment
Hide comment
@githubzaibao

githubzaibao Jun 3, 2017

建议支持本地存储,多一种选择总是好的

githubzaibao commented Jun 3, 2017

建议支持本地存储,多一种选择总是好的

@hutuchong

This comment has been minimized.

Show comment
Hide comment
@hutuchong

hutuchong Jun 23, 2017

呼吁本地上传功能

hutuchong commented Jun 23, 2017

呼吁本地上传功能

@hai046

This comment has been minimized.

Show comment
Hide comment
@hai046

hai046 Jul 11, 2017

首先非常感谢开源
个人强烈建议能上传到本地
如果有其他的商业原因不加 我还能接受

hai046 commented Jul 11, 2017

首先非常感谢开源
个人强烈建议能上传到本地
如果有其他的商业原因不加 我还能接受

@hai046

This comment has been minimized.

Show comment
Hide comment
@hai046

hai046 Jul 12, 2017

我按照源码添加了一个 UploadProcessor ,然后把七牛的url变成了 /upload 并把图片保存到images/upload文件夹 就完成实现了保存本地

  @RequestProcessing(value = "/upload", method = HTTPRequestMethod.POST)
    public void upload(final HTTPRequestContext context) {
        final HttpServletRequest request = context.getRequest();

        final JSONRenderer renderer = new JSONRenderer();

        context.setRenderer(renderer);
        final JSONObject jsonObject = new JSONObject();
memoryFileUploadFactory.setMaxFileSize(MAX_SIZE);
            MultipartStreamParser multipartStreamParser = new MultipartStreamParser(
                    memoryFileUploadFactory);
            multipartStreamParser.parseRequestStream(inputStream, "UTF-8");
            String key = multipartStreamParser.getParameter("key");
 Iterator<String> iterator = multipartStreamParser.getFileParameterNames().iterator();
            while (iterator.hasNext()) {
                String name = iterator.next();
                FileUpload file = multipartStreamParser.getFile(name);
                File saveFile = new File(BASE_DIR, key);
                FileUtils.writeByteArrayToFile(saveFile, file.getFileContent());
                files.put(name);

                jsonObject.put("key", saveFile.getPath());

                logger.info("save {}", saveFile.getAbsolutePath());
                break;
            }
……

注:本人纯属于个人学习使用,没有用于其他用途

hai046 commented Jul 12, 2017

我按照源码添加了一个 UploadProcessor ,然后把七牛的url变成了 /upload 并把图片保存到images/upload文件夹 就完成实现了保存本地

  @RequestProcessing(value = "/upload", method = HTTPRequestMethod.POST)
    public void upload(final HTTPRequestContext context) {
        final HttpServletRequest request = context.getRequest();

        final JSONRenderer renderer = new JSONRenderer();

        context.setRenderer(renderer);
        final JSONObject jsonObject = new JSONObject();
memoryFileUploadFactory.setMaxFileSize(MAX_SIZE);
            MultipartStreamParser multipartStreamParser = new MultipartStreamParser(
                    memoryFileUploadFactory);
            multipartStreamParser.parseRequestStream(inputStream, "UTF-8");
            String key = multipartStreamParser.getParameter("key");
 Iterator<String> iterator = multipartStreamParser.getFileParameterNames().iterator();
            while (iterator.hasNext()) {
                String name = iterator.next();
                FileUpload file = multipartStreamParser.getFile(name);
                File saveFile = new File(BASE_DIR, key);
                FileUtils.writeByteArrayToFile(saveFile, file.getFileContent());
                files.put(name);

                jsonObject.put("key", saveFile.getPath());

                logger.info("save {}", saveFile.getAbsolutePath());
                break;
            }
……

注:本人纯属于个人学习使用,没有用于其他用途

@lihuibo128

This comment has been minimized.

Show comment
Hide comment
@lihuibo128

lihuibo128 Oct 18, 2017

团队内部使用,机器不能连接外网,所以急需能够上传图片和文件到本地功能,搭建的是2.4版本的,请教什么时候能够支持这个功能呢?急需

lihuibo128 commented Oct 18, 2017

团队内部使用,机器不能连接外网,所以急需能够上传图片和文件到本地功能,搭建的是2.4版本的,请教什么时候能够支持这个功能呢?急需

@88250

This comment has been minimized.

Show comment
Hide comment
@88250

88250 Oct 18, 2017

Member

@lihuibo128 可能要让你失望了,我还是坚持初衷,不打算添加了。你参考一下楼上的实现,自己尝试改造一下吧。

Member

88250 commented Oct 18, 2017

@lihuibo128 可能要让你失望了,我还是坚持初衷,不打算添加了。你参考一下楼上的实现,自己尝试改造一下吧。

@tom798

This comment has been minimized.

Show comment
Hide comment
@tom798

tom798 Nov 7, 2017

建议支持本地图片存储!

tom798 commented Nov 7, 2017

建议支持本地图片存储!

@hmmzhtx

This comment has been minimized.

Show comment
Hide comment
@hmmzhtx

hmmzhtx Dec 15, 2017

这个我这边基本图片是放到新浪中的
无本地存储,看来得自己动手了

hmmzhtx commented Dec 15, 2017

这个我这边基本图片是放到新浪中的
无本地存储,看来得自己动手了

@jliu666

This comment has been minimized.

Show comment
Hide comment
@jliu666

jliu666 Jan 10, 2018

阿里云的OSS能够使用吗?或者还是得自己动手写一个

jliu666 commented Jan 10, 2018

阿里云的OSS能够使用吗?或者还是得自己动手写一个

@88250

This comment has been minimized.

Show comment
Hide comment
@88250

88250 Jan 10, 2018

Member

@jliu666 目前只内置了七牛云的实现

Member

88250 commented Jan 10, 2018

@jliu666 目前只内置了七牛云的实现

@DarknessChaser

This comment has been minimized.

Show comment
Hide comment
@DarknessChaser

DarknessChaser Jan 31, 2018

Member

这个博客系统是可以用来当小团伙临时避难的地方的。。。搞了七牛就又回去了。

Member

DarknessChaser commented Jan 31, 2018

这个博客系统是可以用来当小团伙临时避难的地方的。。。搞了七牛就又回去了。

@88250

This comment has been minimized.

Show comment
Hide comment
@88250

88250 Jan 31, 2018

Member

@DarknessChaser Excuse me????

Member

88250 commented Jan 31, 2018

@DarknessChaser Excuse me????

@zwxbest

This comment has been minimized.

Show comment
Hide comment
@zwxbest

zwxbest Feb 22, 2018

1G内存的vps的ssd都在20G或者25G,个人博客存个图片没压力啊。
之前用七牛被盗刷,现在还欠着费呢。

zwxbest commented Feb 22, 2018

1G内存的vps的ssd都在20G或者25G,个人博客存个图片没压力啊。
之前用七牛被盗刷,现在还欠着费呢。

@88250 88250 self-assigned this Feb 22, 2018

@88250 88250 modified the milestones: 2.7.0, 2.8.0 Feb 22, 2018

@battlesteed

This comment has been minimized.

Show comment
Hide comment
@battlesteed

battlesteed Mar 7, 2018

建议加个上传到本地的功能

battlesteed commented Mar 7, 2018

建议加个上传到本地的功能

@88250

This comment has been minimized.

Show comment
Hide comment
@88250

88250 Mar 11, 2018

Member

v2.8.0 中进行实现,在 solo.props 中配置文件存储路径 uploadDir,默认为空,即不启用本地上传,如果配置了该路径则优先使用本地上传。

Member

88250 commented Mar 11, 2018

v2.8.0 中进行实现,在 solo.props 中配置文件存储路径 uploadDir,默认为空,即不启用本地上传,如果配置了该路径则优先使用本地上传。

@88250 88250 closed this Mar 11, 2018

@88250 88250 reopened this Mar 11, 2018

@DarknessChaser

This comment has been minimized.

Show comment
Hide comment
@DarknessChaser

DarknessChaser Mar 11, 2018

Member

@88250 七牛云还要实名制。。。想自己找个不用实名的地方,写点给自己看的东西。

能添加功能真是太谢谢了。

Member

DarknessChaser commented Mar 11, 2018

@88250 七牛云还要实名制。。。想自己找个不用实名的地方,写点给自己看的东西。

能添加功能真是太谢谢了。

88250 added a commit that referenced this issue Mar 11, 2018

88250 added a commit that referenced this issue Mar 11, 2018

88250 added a commit that referenced this issue Mar 11, 2018

88250 added a commit that referenced this issue Mar 11, 2018

88250 added a commit that referenced this issue Mar 11, 2018

88250 added a commit that referenced this issue Mar 15, 2018

@88250 88250 closed this in 955a8eb Mar 15, 2018

@pencilso

This comment has been minimized.

Show comment
Hide comment
@pencilso

pencilso Mar 20, 2018

为什么这个issues还在讨论....

pencilso commented Mar 20, 2018

为什么这个issues还在讨论....

@fuxianwu

This comment has been minimized.

Show comment
Hide comment
@fuxianwu

fuxianwu Sep 1, 2018

建议支持,哎,如果没有计划支持,就只能换了,虽然觉得这个很好用

fuxianwu commented Sep 1, 2018

建议支持,哎,如果没有计划支持,就只能换了,虽然觉得这个很好用

@88250

This comment has been minimized.

Show comment
Hide comment
@88250

88250 Sep 1, 2018

Member

@fuxianwu 已经支持了,请看文档 https://hacpai.com/article/1442418791213 末尾处。

Member

88250 commented Sep 1, 2018

@fuxianwu 已经支持了,请看文档 https://hacpai.com/article/1442418791213 末尾处。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment