Good morning,
I have a file named UploadIMG.aspx with some code html and UploadIMG.aspx.vb and this one empty.
The html and JS part it's something like this:
<div class="wrapper">
<h3>Click to add</h3>
</div>
$("h3").click(function () {
$(".wrapper").append("\
<img id='uploadPreview1' width='200' height='100' /> \
<input id='MyFile' class='inputImage' type='file' onchange='UploadImage();'/>");
});
I want to upload the image to my server whenever they change it on the input but without pressing any button.
I tried to save it with SaveAs but I don't know how to apply this to an onchange.
<script runat="server">
Sub UploadButton_Click(ByVal sender As Object, ByVal e As System.EventArgs)
If (MyFile.HasFile) Then
Dim fileName As String = MyFile.FileName
MyFile.PostedFile.SaveAs(Server.MapPath("~/img/") & MyFile.FileName)
Else
End If
End Sub
Can anyone help me? Thanks
Aucun commentaire:
Enregistrer un commentaire