The Artima Developer Community
Sponsored Link

Python Buzz Forum
Ajax file upload notes

0 replies on 1 page.

Welcome Guest
  Sign In

Go back to the topic listing  Back to Topic List Click to reply to this topic  Reply to this Topic Click to search messages in this forum  Search Forum Click for a threaded view of the topic  Threaded View   
Previous Topic   Next Topic
Flat View: This topic has 0 replies on 1 page
Phillip Pearson

Posts: 1083
Nickname: myelin
Registered: Aug, 2003

Phillip Pearson is a Python hacker from New Zealand
Ajax file upload notes Posted: Jul 28, 2008 4:44 AM
Reply to this message Reply

This post originated from an RSS feed registered with Python Buzz by Phillip Pearson.
Original Post: Ajax file upload notes
Feed Title: Second p0st
Feed URL: http://www.myelin.co.nz/post/rss.xml
Feed Description: Tech notes and web hackery from the guy that brought you bzero, Python Community Server, the Blogging Ecosystem and the Internet Topic Exchange
Latest Python Buzz Posts
Latest Python Buzz Posts by Phillip Pearson
Latest Posts From Second p0st

Advertisement

I'm just getting into the whole fake-Ajax file upload thing.

Interesting discovery: while you can't write to the value of an <input type="file"> element from Javascript, you can clone such elements into other forms and submit them. e.g. in jQuery:

$('#newform').append($('#somefileinput').clone()).submit()

This lets you submit the main form with an XMLHTTPRequest, but move the files off somewhere else to be uploaded in the background and associated with whatever content it was you just uploaded.

Update: If you're doing this in mootools, you'll need to call the DOM cloneNode() method rather than using mootools' clone(), as mootools clones by completely rebuilding the element. In code:

$('newform').grab($('somefileinput').cloneNode()).submit();

Comment

Read: Ajax file upload notes

Topic: Doug's awesome virtualenv scripts Previous Topic   Next Topic Topic: Corporate-to-Startup Transition Checklist

Sponsored Links



Google
  Web Artima.com   

Copyright © 1996-2019 Artima, Inc. All Rights Reserved. - Privacy Policy - Terms of Use