Thanks for your help.
Datafile is a model and just contains a CharField, a FileField a
ForeignKey and some Booleanfields.
-----------------------------------------------
class DataFile(models.Model):
name = models.CharField(max_length=255, null = True)
file = models.FileField(upload_to="data", blank = True, null=True)
experiment = models.ForeignKey(Experiment)
ready = models.BooleanField(null = True) # indicates if
file is already labeled
uploading = models.BooleanField(null = True) # indicates if
file is still uploading
----------------------------------------------
In my view I just try to use the temporaryFileUploadHandler(). Former
I used my own Subclass, but to be sure I just
used the django-native one. This is how I perform the upload:
-----------------------------------------------------
....
def upload(request, id):
form = FileForm()
experiment = get_object_or_404(Experiment, pk=id)
request.upload_handlers = [TemporaryFileUploadHandler()]
if request.method == 'POST' and request.FILES:
form = FileForm(request.POST, request.FILES)
if form.is_valid():
datafile = DataFile(experiment = experiment,
name = "test",
file = form.cleaned_data['file'])
datafile.file.save('test.txt', request.FILES['file'],
save=False)
datafile.save()
-----------------------------------------------------------
I am using revision 1.0 beta 2 -8626 (XP SP2). The code is realy
simple. The only thing I am doing is to use the
TemporaryUploadHandler. And as result I have the >200 files in my
media-directory.
When I wrote the first post, I had the old djangoversion and with that
I got the windows-error(because the filename was longer than 215).
With the new version I dont get this error, but it seems as if the
server gets stuck in an endlessloop. It just idles there.
Further I tried to change FILE_UPLOAD_TEMP_DIR = PROJECT_HTDOCS + '/
media/temp/'
Same result, more than 200 copies in my directory.
Thanks for your help,
Toni
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Django users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---