On 07-May-08, at 3:51 AM, Chris wrote:

>
> Hello I have a csv importer that I have made and I want to upload the
> csv file through a form field as so:
>
> from django import newforms as forms
>
> class ImportForm(forms.Form):
>     """
>     Form for importing CSV files
>     """
>     csv_file = forms.FileField()
>
> next I do something like this:
>
>     form = ImportForm()
>     if request.method == 'POST':
>         form = ImportForm(request.POST, request.FILES)
>         if form.is_valid():
>             if ‘csv_file’ in request.FILES:
>                 try:
>                     csv_file = request.FILES[‘csv_file’][‘content’]
>                 except:
>                     request.FILES[‘csv_file’][‘error’] = True
>
> I am not really sure what I need to do here to get the file and store
> it somewhere. right now it is returning the exception. Any  
> suggestions?

what exception? are you getting request.FILES at all? have you set  
the correct enctype in your template?

-- 

regards
kg
http://lawgon.livejournal.com
http://nrcfosshelpline.in/code/




--~--~---------~--~----~------------~-------~--~----~
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 [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to