On Monday 13 August 2007 10:34:47 [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',
> {"loading": null, "confirm": null,
> "after": null, "on_complete": null,
> "loaded": null, "on_failure":
> "getElement('status').innerHTML='';",
> "on_success":
> "getElement('status').innerHTML='Submitted...';",
> "before":
> "getElement('status').innerHTML='Submitting...';"});""
> 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?

I can't comment on the specific error - but one thing is for sure: one can't 
use AJAX with file input fields. The browser security model won't allow for 
that. 

Google this list for an image editor I once offered here where you can see the 
trick how to do this nontheless, using a hidden IFRAME as form action target.

Diez

--~--~---------~--~----~------------~-------~--~----~
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