On 22-Apr-08, at 1:23 PM, python_fan wrote:

>>> Can I see a working example? I tried various things, and it almost
>>> worked (I got a widget on the page, got an upload button, etc), but
>>> nothing happens when i press Upload/Submit.
>>
>> paste your view and template please
>
> I guess the problem lies mostly in FileUploadForm class. I should have
> some kind of 'save' function there...

your code:
if request.method == 'post':
         upload_form = FileUploadForm(request.POST, request.FILES)

         if not is_valid():
             upload_result = "Invalid form!"
     else:
         upload_form = FileUploadForm()

should be:

if request.method == 'POST':
         upload_form = FileUploadForm(request.POST, request.FILES)

         if upload_form.is_valid():
             file_name = request.FILES['txt_file']['filename']
            file_content=request.FILES['txt_file']['content']
             # here use python to save the file
else:
         upload_form = FileUploadForm()

-- 

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