Ben önce onu deşifre böylece base64 dize olarak alma ve sonra bu başarısız database.However kaydetmek side.I sunucuda bir görüntü kurtarmaya çalışıyorum böylece sunucu hatası günlüğünü kontrol ve ben wsgi.pyİstisna işleme WSGI senaryoyu oluştu - IOError: veri yazma başarısız
import os
import sys
path = '/root/AR_BROWSER/example'
sys.path.append('/root/AR_BROWSER/example')
sys.path.append('/root/AR_BROWSER')
sys.path.append('/root/AR_BROWSER/example/app')
os.environ['DJANGO_SETTINGS_MODULE'] = 'settings'
import django.core.handlers.wsgi
application = django.core.handlers.wsgi.WSGIHandler()
kontrol Ama ben yanlış bir şey bulamıyorum şu error.log
[Tue May 21 14:26:38 2013] [error] [client 41.236.182.133] mod_wsgi (pid=4952): Exception occurred processing WSGI script '/root/AR_BROWSER/example/wsgi.py'.
[Tue May 21 14:26:38 2013] [error] [client 41.236.182.133] IOError: failed to write data
bulundu. Bu sorunun sebebi ne olabilir ?! hiçbir traceback ile görüntüyü
@csrf_exempt
def create_app(request):
appName = request.POST['name']
user = request.POST['userID']
c = request.POST['category']
i = request.POST['image']
imgdata = base64.b64decode(i)
t = datetime.now()
filename = t.strftime('test.jpg')
with open(filename, 'w') as f:
f.write(imgdata)
f.close()
u=App_User.objects.get(id=user)
apps = App.objects.create(name = appName, category=c, user_id = u.id, app_logo=File(filename))
apps.save()
return HttpResponse("You created %s." % apps.name)
çek (apache kullanıcı için) izin ve disk alanı –
kontrol chmod 777 kullanarak izinleri kontrol edilip görüntü boyutu yüzden bir sorun değil, tıpkı 25kb olduğunu. – omarsafwany
Bir resmi kaydeden asıl kodu gösterebilir misiniz? – alecxe