Welcome Guest, Not a member yet? Register   Sign In
file upload with scriptaculous and code igniter?
#1

[eluser]edwardmolasses[/eluser]
hi everyone,

I was wondering if anyone was able to do file uploads with code igniter and scriptaculous?

I have the following scriptaculous/js code that executes when someone clicks the file upload button:

Code:
new Ajax.Updater('addImagesDiv', '<?=site_url()?>/weddings/ajaxAddImage/<?=$this->db_session->userdata('id')?>', {method:'post', asynchronous:true, evalScripts:true, parameters:Form.serialize('f1')});

where f1 is the form name and the file input looks like:

Code:
<input class="inputClass" type="file" name="userfile">

And in my controller ajax function ajaxAddImage, I do the traditional code igniter upload, but it doesn't upload the file and i get the error:

Quote:Unable to find a post variable called userfile.

Does anyone have any tips?

thanks,
andrew.
#2

[eluser]Base Willy[/eluser]
It's not possible to upload file via ajax, the only possibility of background uploading is hidden frame or flash. For flash I could recommend one solution: http://swfupload.mammon.se/
#3

[eluser]thurting[/eluser]
In the past I have used an iframe to upload a files while retaining state on the current page. When the frame reloads I combine it with a bit of ajax to dynamically display/delete the uploaded file on the page. I haven't done this in a while, but I am pretty sure I did it with Prototype and Scriptaculous. I could dig it out for you if you want.

edit: i found the files... PM me if you want them
#4

[eluser]edwardmolasses[/eluser]
Thanks a lot for the info, i'm still a bit of an scriptaculous beginner, ack. After your posts and doing a bit of researching, it looks like we might go with a different interface to make it easy on ourselves. Thanks so much for the help though!




Theme © iAndrew 2016 - Forum software by © MyBB