Go Back   CodingForums.com > :: Client side development > JavaScript programming > JavaScript frameworks

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 11-14-2008, 03:18 PM   PM User | #1
tosbourn
Regular Coder

 
Join Date: Aug 2008
Location: Northern Ireland
Posts: 167
Thanks: 12
Thanked 6 Times in 6 Posts
tosbourn is on a distinguished road
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.
tosbourn is offline   Reply With Quote
Old 11-14-2008, 05:06 PM   PM User | #2
NancyJ
Senior Coder

 
NancyJ's Avatar
 
Join Date: Feb 2005
Location: Bradford, UK
Posts: 3,162
Thanks: 19
Thanked 65 Times in 64 Posts
NancyJ will become famous soon enough
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
__________________
http://www.hazelryan.co.uk
NancyJ is offline   Reply With Quote
Users who have thanked NancyJ for this post:
tosbourn (11-17-2008)
Old 11-17-2008, 09:07 AM   PM User | #3
tosbourn
Regular Coder

 
Join Date: Aug 2008
Location: Northern Ireland
Posts: 167
Thanks: 12
Thanked 6 Times in 6 Posts
tosbourn is on a distinguished road
Thank you so much, I was leaning towards using an iframe but try to avoid them unless I absolutely have to!
tosbourn is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 12:40 PM.


Advertisement
Log in to turn off these ads.