You cannot send a file via normal ajax, it's a browser "security
feature". If you want to do it you have to do one of two things:

1. Use a flash uploader instead
2. Put your form in an iframe.

On Aug 13, 8:34 pm, "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> wrote:
> Hi
>
> Apparently ajaxForm/remoteForm has a problem with a file form input.
> If I dont' include the 'py:attrs' in the form tag declaration, then
> the page will force a redirect on success...just like a normal form
> rather than an AJAX form...this is not what I want. If I *do* include
> the 'py:attrs" in the form tag, then the HTML substituted missing HTML
> looks like this:  "onsubmit="return !remoteFormRequest(this, 'status',
> {&quot;loading&quot;: null, &quot;confirm&quot;: null,
> &quot;after&quot;: null, &quot;on_complete&quot;: null,
> &quot;loaded&quot;: null, &quot;on_failure&quot;:
> &quot;getElement('status').innerHTML='';&quot;,
> &quot;on_success&quot;:
> &quot;getElement('status').innerHTML='Submitted...';&quot;,
> &quot;before&quot;:
> &quot;getElement('status').innerHTML='Submitting...';&quot;});""
> Doing this causes an error as seen below:
>
>     filename = getRandomStr(4) + '_' +
> os.path.basename(fileobj.filename)
> AttributeError: 'unicode' object has no attribute 'filename'
> Request Headers:
>   COOKIE: tg-visit=09b3803694f3a69c91b5fcde87035124f73e63c9
>   Content-Length: 105
>   ACCEPT-CHARSET: ISO-8859-1,utf-8;q=0.7,*;q=0.7
>   USER-AGENT: Mozilla/5.0 (Macintosh; U; PPC Mac OS X Mach-O; en-US;
> rv:1.8.0.12) Gecko/20070508 Firefox/1.5.0.12
>   CONNECTION: close
>   PRAGMA: no-cache
>   CONTENT-LENGTH: 105
>   HOST: localhost:8080
>   CACHE-CONTROL: no-cache
>   CONTENT-TYPE: application/x-www-form-urlencoded
>   ACCEPT: text/xml,application/xml,application/xhtml+xml,text/
> html;q=0.9,text/plain;q=0.8,image/png,*/*;q=0.5
>   Remote-Addr: 127.0.0.1
>   ACCEPT-LANGUAGE: en-us,en;q=0.5
>   Content-Type: application/x-www-form-urlencoded
>   Remote-Host: 127.0.0.1
>   ACCEPT-ENCODING: gzip,deflate
>   KEEP-ALIVE: 300
>
> My normal AJAX forms without file input fields work fine, and my file
> input form that is NON-AJAX also works fine.  But putting them
> together results in this error?
>
> Possibly the file object is not being passed correct to the remote
> form?  Anybody care to comment?


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"TurboGears" 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/turbogears?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to