Hi; How to use ajax.updater to upload a file? I have tried to specify enctype directly in the option and also tried it in the requestHeaders. Seems nothing works. Does prototype support file upload? Thanks very much. yufeng --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On 05 Dec 2006, at 11:05, yufeng wrote:> How to use ajax.updater to upload a file? I have tried to specify > enctype directly in the option and also tried it in the > requestHeaders. > Seems nothing works. Does prototype support file upload? Thanks very > much.JavaScript doesn''t allow file uploads, you have to use tricks like a hidden iframe to support "ajax" uploads. A quick google search would have taken you a long way: http://www.google.com/search?client=safari&rls=en&q=ajax +uploads&ie=UTF-8&oe=UTF-8 Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
Hey there, Peter De Berdt a écrit :> JavaScript doesn''t allow file uploads, you have to use tricks like a > hidden iframe to support "ajax" uploads.Although the IFRAME trick sure is simpler and is the only way to upload a file from the client''s filesystem, I''m not convinced "JS doesn''t allow file uploads." A file upload is nothing more than a POST request with proper request Content-Type, and a multipart-wrapped, usually Base64-encoded, file contents. Which means that JS could synthetize the file contents and upload it. However, JS *cannot* access files on the client''s file system. In this regard, it cannot access an <input type="file".../>-defined file contents from the local machine, and therefore cannot encode it and post it manually. This is, almost, a distinction without a difference, but I felt in a mood for exactitude this morning :-) -- Christophe Porteneuve aka TDD tdd-x+CfDp/qHev2eFz/2MeuCQ@public.gmane.org --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On 05 Dec 2006, at 11:27, Christophe Porteneuve wrote:> Although the IFRAME trick sure is simpler and is the only way to > upload > a file from the client''s filesystem, I''m not convinced "JS doesn''t > allow > file uploads."The IFRAME trick isn''t the only way: http://labb.dev.mammon.se/ swfupload/ This one even allows upload progress without having to rely on server side stuff like mongrel upload progress. Best regards Peter De Berdt --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---
On Dec 5, 11:09 am, Peter De Berdt <peter.de.be...-LPO8gxj9N8aZIoH1IeqzKA@public.gmane.org> wrote:> ... you have to use tricks like a > hidden iframe to support "ajax" uploads.I was thinking about patching Form and/or Ajax to allow this. The IFRAME hack is actually quite simple. Do you think this functionality belongs to the framework? I would think so, because every project sooner or later wants files - and what better than asynchronous upload? :) -M --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Ruby on Rails: Spinoffs" group. To post to this group, send email to rubyonrails-spinoffs-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org To unsubscribe from this group, send email to rubyonrails-spinoffs-unsubscribe-/JYPxA39Uh5TLH3MbocFFw@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-spinoffs?hl=en -~----------~----~----~----~------~----~------~--~---