• 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Question about uploading pics and jquery

hey guys,

it's been a great adventure learning and using CI and I am saying this honestly the forum is almost the best I have ever used.
Anyway enof talk, I have a question like the title of this post says.

I have a form that pictures for an intranet application get uploaded through. the question is this: do I need to serialize the data from the upload form since I am using ajax with jquery? before I did the ajax thing the form would upload fine but take me away from the upload page. now the error message shows up on the same page with the form like I want it but no picture is uploaded. Below is my jquery code:


url: 'upload_picture',
type: 'POST',
data: $('#uploadpics').serialize(),
beforeSend: function(){
$('#aika').append('<p>Uploading...<img src="../images/ajax-loader.gif"/></p>').show('slow');
success: function(data){
} else {


thanks guys and God bless.

Not so much a CI question really but alot of jquery users around here Wink

Disclaimer: I've never tried this but I doubt you can use $.ajax to upload a file.
I believe you need a jquery plugin to handle the multipart/form-data encode type. SOme googling indicates that there's a form plugin for this.

thanks bretticus,

your answer already has put some ideas in my head. will try what I can and see. I don't feel comfortable using form plugins with jquery but I will look into it and see.
Thanks Bro.

Digg   Delicious   Reddit   Facebook   Twitter   StumbleUpon  

  Theme © 2014 iAndrew  
Powered By MyBB, © 2002-2021 MyBB Group.