保存圖像(13「權限被拒絕」)試圖上傳在Django 的圖像時,我檢查了其中的圖像將被保存 drwxr目錄的訪問權限發生錯誤-xr-x 2 hsrd hsrd 4096 2010-03-19 15:49媒體問題的上傳和Django中
請爲此提出解決方案。
if request.method == 'POST':
if 'file' in request.FILES:
file = request.FILES["file"]
fdata = file.read(file.size)
b = base64.b64encode(fdata)
from StringIO import StringIO
content=StringIO(fdata)
upload_dir = settings.MEDIA_ROOT
destination =os.path.join(upload_dir, image_name)
from PIL import Image
img = Image.open(content)
image_to_scratch(img,destination)
return render_to_response('ocr/ocr.html',{
'filename':file.name,
'hasImage':True,
'imgdata':r'data:image/png;base64,' + b
})
我沒有使用mod_wsgi.i,如教程http://docs.djangoproject.com/en/dev/howto/deployment/modpython/?from=olddocs – indu 2010-07-09 09:01:50
中所述,嘗試使用modpython解決了問題,改變了文件路徑在哪個圖像保存到/ tmp – indu 2010-07-09 10:51:41
即時消息很高興你已經解決了這個問題,但如果圖像要永久存儲/ tmp不是他們去的地方! – sjh 2010-07-13 16:58:11