Skip to content
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

图片前戳跟指定目录上传配置 #27

Open
JHeLiu opened this issue Jul 4, 2021 · 5 comments
Open

图片前戳跟指定目录上传配置 #27

JHeLiu opened this issue Jul 4, 2021 · 5 comments

Comments

@JHeLiu
Copy link

JHeLiu commented Jul 4, 2021

比如我指定了
imagePathFormat
d:/as/upload/pic/{yyyy}{mm}{dd}/{time}{rand:6}
imageUrlPrefix = htt://baidu.com

它返回给前端是 imageUrlPrefix +imagePathFormat
有什么设置可以直接用 截取掉盘符路径

或者实现在配置文件中添加

removePartPrefix ?

@baiyunchen
Copy link
Owner

你使用的姿势可能有点问题。目前项目没法支持将文件发布存储在多个磁盘中,如果你只是需要将图片存储到一个指定的目录,而非当前项目部署的目录,可以按照以下的方案实现:

以下解决方案针对于.NET core,.NET Framework也类似,可以自行探索。

  • 在初始化UEditor时,指定一个basePath,比如 d:/as/
  • 你的imagePathFormat 配置应该改成:/upload/pic/{yyyy}{mm}{dd}/{time}{rand:6}
  • 这时API端返回的URL就会是 按照imagePathFormat格式化后的一个路径。而你的文件会被保存到 basePath 加上给你返回的URL这个路径下,也就是会保存到:d:/as/upload/pic/{yyyy}{mm}{dd}/{time}{rand:6}

这个方案只是大概的实现思路,具体细节你可以再摸索一下。

@JHeLiu
Copy link
Author

JHeLiu commented Jul 4, 2021

静态文件放在独立的站点,也就是独立的盘符中,看来只能我去修改下源代码 转换路径那一部分了

@baiyunchen
Copy link
Owner

独立的站点、独立的盘符都是可以支持的。

@JHeLiu
Copy link
Author

JHeLiu commented Jul 4, 2021

这样配置文件是不是也得丢到指定盘符中去

@baiyunchen
Copy link
Owner

跟配置文件放哪里没有关系,就是我上面说的那样,你可以先试试。或者去阅读下源码看看。实在不符合需求就自己稍作调整。

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants