(13, 'Permission denied') error occurs when trying to upload an image in Django i have checked the access rights of the directory in which image will be saved drwxr-xr-x 2 hsrd hsrd 4096 2010-03-19 15:49 media
Please a suggest a solution for this.
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
})