2008-07-20 20:44:41 +08:00
|
|
|
import tempfile
|
|
|
|
import os
|
|
|
|
from django.db import models
|
2008-08-09 04:59:02 +08:00
|
|
|
from django.core.files.storage import FileSystemStorage
|
2008-07-20 20:44:41 +08:00
|
|
|
|
2008-08-09 04:59:02 +08:00
|
|
|
temp_storage = FileSystemStorage(tempfile.mkdtemp())
|
|
|
|
UPLOAD_TO = os.path.join(temp_storage.location, 'test_upload')
|
2008-07-20 20:44:41 +08:00
|
|
|
|
|
|
|
class FileModel(models.Model):
|
2008-08-09 04:59:02 +08:00
|
|
|
testfile = models.FileField(storage=temp_storage, upload_to='test_upload')
|