uploading and preview image with ajax - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: Archived Discussions (https://forum.codeigniter.com/forumdisplay.php?fid=20) +--- Forum: Archived Development & Programming (https://forum.codeigniter.com/forumdisplay.php?fid=23) +--- Thread: uploading and preview image with ajax (/showthread.php?tid=8735) |
uploading and preview image with ajax - El Forum - 05-29-2008 [eluser]nuttynibbles[/eluser] hello, im doing a function to upload photo. i would like to use ajax for user to preview the photo before submitting the form. so basically i want the user to click onto preview button where it will use ajax to preview the img to the user by saving the img file in a temp folder. here is my code for the html: Code: <form name="frmregister" method="post" action="http://url/codeigniter/upload/do_upload" enctype="multipart/form-data"> i found a ajax file on CI forum. it looks like this: Code: var ajaxPost = function() { can someone show me how to go about doing this. tks uploading and preview image with ajax - El Forum - 08-31-2009 [eluser]hihew[/eluser] did you found the way to do this already? care to share? uploading and preview image with ajax - El Forum - 01-08-2010 [eluser]hihew[/eluser] can you share this please.. uploading and preview image with ajax - El Forum - 07-23-2011 [eluser]Unknown[/eluser] Notice this line in that code ? Code: request.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); As far as I know, XMLHttpRequest currently doesn't support multipart/form-data. But you can still Ajaxify your file uploader by setting target attribute of your uploader form to some hidden iframe. Go to some search engine and search for "Ajax file uploader". You will get lot of examples in PHP. Once you have understood how it works it will be very easy for you to do it in Code Igniter. |