Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
tree: 38ac575ddb
Fetching contributors…

Cannot retrieve contributors at this time

23 lines (20 sloc) 0.534 kb
from chunked_uploads.models import Upload, Chunk
def handle_upload(uploaded_file, who):
"""
Expects to handle an individual file from request.FILES[name]
Returns an Upload object
"""
u = Upload.objects.create(
user=who,
filename=uploaded_file.name,
filesize=uploaded_file.size
)
Chunk.objects.create(
upload=u,
chunk=uploaded_file,
chunk_size=uploaded_file.size
)
u.state = Upload.STATE_COMPLETE
u.save()
u.stitch_chunks()
return u
Jump to Line
Something went wrong with that request. Please try again.