Also check the FileField for info on how django handles files by default. 
Probably the best starting point.

http://docs.djangoproject.com/en/dev/ref/models/fields/#filefield

and sending files is a view like this:

def project_download(request,  project,  filename,  version):
  project_file = get_object_or_404(ProjectFile, project__slug__exact=project,  
name__exact=filename,  version__icontains=version)
  file_name  = os.path.basename(project_file.file.name)
  mimetype,  encoding = mimetypes.guess_type(project_file.file.path)
  response = HttpResponse(mimetype=mimetype)
  response.write(project_file.file.path)
  response['Content-Disposition'] = 'attachment; filename=%s' %(file_name)

The Content-Dispostion header is what lets the browser know there is a file 
coming (sorry for hitting send a bit early).

Mike.  
-- 
Work smarter, not harder, and be careful of your speling.

Attachment: signature.asc
Description: This is a digitally signed message part.

Reply via email to