我是靠谱客的博主 陶醉睫毛膏,最近开发中收集的这篇文章主要介绍通过运营界面上传图片失败,浏览器提示上传文件时发生HTTP错误(错误代码:500),觉得挺不错的,现在分享给大家,希望可以做个参考。

概述

通过运营界面上传图片失败,浏览器提示上传文件时发生HTTP错误(错误代码:500)


ERROR exception 135 Internal Server Error: /ckeditor/upload/
Traceback (most recent call last):
  File "/home/python/.virtualenvs/django_meiduo/lib/python3.5/site-packages/django/core/handlers/exception.py", line 41, in inner
    response = get_response(request)
  File "/home/python/.virtualenvs/django_meiduo/lib/python3.5/site-packages/django/core/handlers/base.py", line 187, in _get_response
    response = self.process_exception_by_middleware(e, request)
  File "/home/python/.virtualenvs/django_meiduo/lib/python3.5/site-packages/django/core/handlers/base.py", line 185, in _get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/python/.virtualenvs/django_meiduo/lib/python3.5/site-packages/django/contrib/auth/decorators.py", line 23, in _wrapped_view
    return view_func(request, *args, **kwargs)
  File "/home/python/.virtualenvs/django_meiduo/lib/python3.5/site-packages/django/views/decorators/csrf.py", line 58, in wrapped_view
    return view_func(*args, **kwargs)
  File "/home/python/.virtualenvs/django_meiduo/lib/python3.5/site-packages/django/views/generic/base.py", line 68, in view
    return self.dispatch(request, *args, **kwargs)
  File "/home/python/.virtualenvs/django_meiduo/lib/python3.5/site-packages/django/views/generic/base.py", line 88, in dispatch
    return handler(request, *args, **kwargs)
  File "/home/python/.virtualenvs/django_meiduo/lib/python3.5/site-packages/ckeditor_uploader/views.py", line 95, in post
    if(str(saved_path).split('.')[1].lower() != 'gif'):
IndexError: list index out of range
ERROR basehttp 124 "POST /ckeditor/upload/ HTTP/1.1" 500 97951


重点看这一句---if(str(saved_path).split('.')[1].lower() != 'gif')


我们将通过Django上传的图片保存到了FastDFS中,而保存在FastDFS中的文件名没有后缀名,ckeditor在处理上传后的文件名按照有后缀名来处理,所以会出现bug错误

找到虚拟环境目录中的ckeditor_uploader/views.py文件如:
~/.virtualenvs/meiduo/lib/python3.5/site-packages/ckeditor_uploader/views.py

将第95行代码修改如下:


然后就成功上传


最后

以上就是陶醉睫毛膏为你收集整理的通过运营界面上传图片失败,浏览器提示上传文件时发生HTTP错误(错误代码:500)的全部内容,希望文章能够帮你解决通过运营界面上传图片失败,浏览器提示上传文件时发生HTTP错误(错误代码:500)所遇到的程序开发问题。

如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。

本图文内容来源于网友提供,作为学习参考使用,或来自网络收集整理,版权属于原作者所有。
点赞(68)

评论列表共有 0 条评论

立即
投稿
返回
顶部