Image preview before upload using asp.net webpages & webmatrix + Jquery
-
i've been trying to use a jquery & ajax plugin for the image preview but i cant for the life of me get it to work. This is the site I found the code/demo http://www.zurb.com/playground/ajax_upload I can get as far as changing the preview background but then no image is shown for the selected image file. this is my ,chtml file <!DOCTYPE html> <html lang="en"> <head> <meta charset="utf-8" /> <link href="@Href("~/Styles/jquery/jquery.ui.all.css")" rel="stylesheet" type="text/css" /> <link href="@Href("~/Styles/Site.css")" rel="stylesheet" type="text/css" /> <script src="@Href("~/Scripts/jquery-1.7.js")" type="text/javascript"></script> <script src="@Href("~/Scripts/jquery-ui-1.8.11.js")" type="text/javascript"></script> <script src="@Href("~/Scripts/jquery.js")" type="text/javascript"></script> <script src="@Href("~/Scripts/ajaxupload.js")" type="text/javascript"></script> <script> $(document).ready(function(){ var thumb = $('img#thumb'); new AjaxUpload('imageUpload', { action: $('form#newHotnessForm').attr('action'), name: 'image', onSubmit: function(file, extension) { $('div.preview').addClass('loading'); alert(file); }, onComplete: function(file, response) { thumb.load(function() { $('div.preview').removeClass('loading'); thumb.unbind(); }); thumb.attr('src', response); } }); }); </script> </head> <body> <h2>New Hotness</h2> <div> <div class="preview"> <img id="thumb" width="100px" height="100px" src="../Images/Test.jpg" /> </div> <form id="newHotnessForm"> <label>Upload a Picture of Yourself</label> <input type="file" id="imageUpload" size="20" /> <button type="submit" class="button">Save</button> </form> </div> </body> </html>
-
Answer:
davey at Stack Overflow Visit the source
Related Q & A:
- How can I allow user to create posts in website using ASP.NET?Best solution by Programmers
- How to Undo previous action in asp.net?Best solution by forums.asp.net
- How to Search using jQuery ASP.Net?Best solution by Stack Overflow
- How to save high resolution image canvas to server using asp.net?Best solution by Stack Overflow
- Is there some kind of API for MSN protocol (for using in C# asp.net application?Best solution by Stack Overflow
Just Added Q & A:
- How many active mobile subscribers are there in China?Best solution by Quora
- How to find the right vacation?Best solution by bookit.com
- How To Make Your Own Primer?Best solution by thekrazycouponlady.com
- How do you get the domain & range?Best solution by ChaCha
- How do you open pop up blockers?Best solution by Yahoo! Answers
For every problem there is a solution! Proved by Solucija.
-
Got an issue and looking for advice?
-
Ask Solucija to search every corner of the Web for help.
-
Get workable solutions and helpful tips in a moment.
Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.