CodingForums.com

CodingForums.com (http://www.codingforums.com/index.php)
-   JavaScript frameworks (http://www.codingforums.com/forumdisplay.php?f=62)
-   -   jQuery Uploading Files (http://www.codingforums.com/showthread.php?t=152254)

tosbourn 11-14-2008 03:18 PM

jQuery Uploading Files
 
I am pretty much completely new to jQuery and I have a quick question regarding getting certain attributes.

I want to allow file uploads via one particular form, however I would like it if the form could be handled in the same way all other forms are on this project (they are not submitted using HTML, all is done using jQuery and $.post)

I am not sure if this is even possible, but is there a way of grabbing the file contents, size and type from within jQuery - doing something like...

Code:

alert($("#file").val());
Return the filename but nothing else (unless this is the first element of an array, and if so how do I access the other elements?

Cheers in advance.

NancyJ 11-14-2008 05:06 PM

Its not possible to upload files via ajax. You can set your forms target to an iframe and upload the file without reloading the page but its not technically ajax.

This tutorial explains the technique in detail with a few extras that aren't necessary http://www.chronosight.net/view/2006...pt-iframe.html

tosbourn 11-17-2008 09:07 AM

Thank you so much, I was leaning towards using an iframe but try to avoid them unless I absolutely have to!


All times are GMT +1. The time now is 11:44 PM.

Powered by vBulletin®
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.