Right now, I am working on a Multimedia-Project for my study. The task is to create a crowdfunding-platform. My problem is the local preview image on the "Create a Project"-page. I used the forum search and came across this:
http://www.xul.fr/en/html5/filereader.php
I copied the code and put it in my HTML/JS Files like this:
This is my HTML-Code so far:
<div class="header">
ICH BIN DER HEADER, HIER KOMMT HEAD-KRAM REIN
</div> <!-- HEADER GESCHLOSSEN -->
<!-- -------------------------1------------------------------- -->
<div class="slideshow">
    <div id="titelbild">
        <input type="file" id="getimage">
        <fieldset><legend>Your image here</legend>
        <div id="imgstore"></div>
        </fieldset> 
    </div> <!-- TITELBILD GESCHLOSSEN -->
    <div id="projektinfos">
        <input type="text" id="titel" maxlength="60" value="Titel" onFocus="if(this.value=='Titel') this.value='';" onBlur="if(this.value=='')this.value='Titel';">
        <select id="rewardfarbe">
            <option selected>Kategorie wählen   </option>
            <option>Rot         </option>
            <option>Grün        </option>
            <option>Blau        </option>
        </select>
        <input type="text" class="textbox" maxlength="60" value="Betrag" onFocus="if(this.value=='Betrag') this.value='';" onBlur="if(this.value=='')this.value='Betrag';">
        <input type="text" class="textbox" maxlength="60" value="Ort" onFocus="if(this.value=='Ort') this.value='';" onBlur="if(this.value=='')this.value='Ort';">  
    </div> <!-- PROJEKTINFOS GESCHLOSSEN -->
</div> <!-- SLIDESHOW GESCHLOSSEN -->
<!-- -------------------------2------------------------------- -->
<div id="details">
</div>
<!-- -------------------------3------------------------------- -->
<div class="footer">
</div>
And my JavaScript-Code:
<script>
function imageHandler(e2) 
{ 
  var store = document.getElementById('imgstore');
  store.innerHTML='<img src="' + e2.target.result +'">';
}
function loadimage(e1)
{
  var filename = e1.target.files[0]; 
  var fr = new FileReader();
  fr.onload = imageHandler;  
  fr.readAsDataURL(filename); 
}
window.onload=function()
{
  var x = document.getElementById("filebrowsed");
  x.addEventListener('change', readfile, false);
  var y = document.getElementById("getimage");
  y.addEventListener('change', loadimage, false);
}
</script>
And my CSS-Code:
.body {
    width: 1280px;
    height: 2000px;
    background-image:url(images/fabric_patterns_2_source_SMALL.jpg); 
} 
/* -------------------------0------------------------------- */
.header {
    margin: auto;
    width: 900px;
    height: 80px;
    background-color:#FFBD91;
}
/* -------------------------1------------------------------- */
.slideshow {
    margin: auto;
    width: 1024px;
    height: 300px;
    background-color: #ACB6FF;
}
#titelbild {
    float: left;
    width: 400px;
    height: 300px;
    background-image:url(images/bildhinzufuegen.gif);
}
#titelbildhinzufuegen {
    width: 400px;
    height: 300px;
    opacity: 0;
}
#projektinfos {
    float: right;
    width: 624px;
    height: 300px;
    background-color:#B6FF98;
}
/* -------------------------2------------------------------- */
#details {
    margin: auto;
    width: 900px;
    height: 1500px;
    background-color: #C0E3FF;
}
#titel {
    font-family: Helvetica,Verdana,Arial,sans-serif;
    font-size: 18px;
    margin-left: 112px;
    margin-top: 20px;
    width: 400px;
    height: 50px;
}
#rewardfarbe {
    width: 200px;
    height: 50px;
    margin-top: 20px;
    margin-left: 312px;
}
.textbox {
    font-family: Helvetica,Verdana,Arial,sans-serif;
    font-size: 18px;
    margin-left: 312px;
    margin-top: 20px;
    width: 200px;
    height: 50px;
}
/* -------------------------3------------------------------- */
.footer {
    margin: auto;
    width: 900px;
    height: 80px;
    background-color: #B0BAFF;
}
Like I said, I copied the Code right from the link at the beginning of my post, but it won't work...I don't understand it. Is it possible, that this has to be running on a real Server, because right now, I'm testing all my work with XAMPP.
 
     
     
    