Click here to Skip to main content
15,891,905 members
Home / Discussions / ASP.NET
   

ASP.NET

 
QuestionHelp with fileupload object Pin
turbosupramk31-Jun-16 6:03
turbosupramk31-Jun-16 6:03 
AnswerRe: Help with fileupload object Pin
Richard Deeming1-Jun-16 6:55
mveRichard Deeming1-Jun-16 6:55 
GeneralRe: Help with fileupload object Pin
turbosupramk31-Jun-16 7:39
turbosupramk31-Jun-16 7:39 
GeneralRe: Help with fileupload object Pin
Richard Deeming1-Jun-16 7:52
mveRichard Deeming1-Jun-16 7:52 
GeneralRe: Help with fileupload object Pin
turbosupramk31-Jun-16 8:07
turbosupramk31-Jun-16 8:07 
GeneralRe: Help with fileupload object Pin
Richard Deeming1-Jun-16 8:16
mveRichard Deeming1-Jun-16 8:16 
GeneralRe: Help with fileupload object Pin
turbosupramk31-Jun-16 9:21
turbosupramk31-Jun-16 9:21 
GeneralRe: Help with fileupload object Pin
Richard Deeming2-Jun-16 1:46
mveRichard Deeming2-Jun-16 1:46 
The <script> block needs to be within the document - just before the closing </body> tag would be a good place.

You also need to add a reference to jQuery, since you're using it to wire up the event handler. The jQuery CDN[^] is probably the simplest way to add this.

There's no need for the xmlns declaration on the <html> tag, since you're using HTML5, not XHTML. You also don't need the language attribute on the <script> tag, since Javascript is the only supported language.

HTML
<!DOCTYPE html>
<html>
<head runat="server">
    <title>Exchange Avatar</title>
</head>
<body>
    <form id="form1" runat="server">
        <br /><br /><br />
        <input type="file" id="imgInp" />
        <img id="blah" src="#" alt="your image" />
    </form>
    
    <!-- Include jQuery: -->
    <script src="https://code.jquery.com/jquery-1.12.4.min.js" integrity="sha256-ZosEbRLbNQzLpnKIkEdrPv7lOy9C27hHQ+Xp8a4MxAQ=" crossorigin="anonymous"></script>
    
    <!-- Your script: -->
    <script>
    function readURL(input) {
        if (input.files && input.files[0]) {
            var reader = new FileReader();
            reader.onload = function (e) {
                $("#blah").attr("src", e.target.result);
            }
            reader.readAsDataURL(input.files[0]);
        }
    }

    $("#imgInp").change(function () {
        readURL(this);
    });
    </script>
</body>
</html>




"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer


GeneralRe: Help with fileupload object Pin
turbosupramk32-Jun-16 2:43
turbosupramk32-Jun-16 2:43 
GeneralRe: Help with fileupload object Pin
Richard Deeming2-Jun-16 2:45
mveRichard Deeming2-Jun-16 2:45 
GeneralRe: Help with fileupload object Pin
turbosupramk32-Jun-16 4:00
turbosupramk32-Jun-16 4:00 
GeneralRe: Help with fileupload object Pin
Richard Deeming2-Jun-16 4:24
mveRichard Deeming2-Jun-16 4:24 
GeneralRe: Help with fileupload object Pin
turbosupramk32-Jun-16 4:28
turbosupramk32-Jun-16 4:28 
GeneralRe: Help with fileupload object Pin
Richard Deeming2-Jun-16 4:31
mveRichard Deeming2-Jun-16 4:31 
GeneralRe: Help with fileupload object Pin
turbosupramk32-Jun-16 8:42
turbosupramk32-Jun-16 8:42 
Questionaccessing Local IP camera Pin
Member 1062117328-May-16 0:49
Member 1062117328-May-16 0:49 
AnswerRe: accessing Local IP camera Pin
Mycroft Holmes29-May-16 21:58
professionalMycroft Holmes29-May-16 21:58 
QuestionWhy is Panel visibility always showing false? Pin
samflex27-May-16 10:37
samflex27-May-16 10:37 
AnswerRe: Why is Panel visibility always showing false? Pin
F-ES Sitecore29-May-16 6:13
professionalF-ES Sitecore29-May-16 6:13 
GeneralRe: Why is Panel visibility always showing false? Pin
samflex29-May-16 16:51
samflex29-May-16 16:51 
GeneralRe: Why is Panel visibility always showing false? Pin
Richard MacCutchan29-May-16 21:27
mveRichard MacCutchan29-May-16 21:27 
GeneralRe: Why is Panel visibility always showing false? Pin
F-ES Sitecore30-May-16 0:03
professionalF-ES Sitecore30-May-16 0:03 
GeneralRe: Why is Panel visibility always showing false? Pin
ZurdoDev26-Oct-16 15:46
professionalZurdoDev26-Oct-16 15:46 
QuestionMoving a website from a 2008 server to a 2012 server without having the application source code. Pin
Stephen Holdorf25-May-16 4:21
Stephen Holdorf25-May-16 4:21 
AnswerRe: Moving a website from a 2008 server to a 2012 server without having the application source code. Pin
ZurdoDev25-May-16 4:39
professionalZurdoDev25-May-16 4:39 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.