Hi django-users I try to figure out how to upload files using django.
I have two models which are involved here: Post, which has a user and content. Attachment, which has a filefield (attachment), a user and a FK to Post. This is how it should work: Step 1: The form is displayed with all fields If user clicks on 'add attachment button' go to step 2 If user clicks on 'submit' button go to stop 4 Step 2: Check if a file is submitted Check user file size and count quota Check file for viri with pyclamav Check file size Check file type If all checks are positive, go to step 3 Else show an error page and go to step 1 Step 3: Save the newly uploaded file to the Attachment model Go to Step 1 and display the uploaded attachments (not as part of the form) Step 4: The rest of the form is saved to the Post model The currently orphaned attachments get linked to the created Post model Display a success page The step where I have problems is step 3. After checking the file content using pyclamav I tried to store the data in the attachment model using: Attachment(owner=request.user, attachment=data) where data is the file content. This saved correctly with no errors but the file path (eg attachment.url) doesn't point to the upload_to folder (it points to the root media folder) and the file wasn't created. How could I do that? Jonas --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to django-users+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---