php - select image on drive with javascript -
I have created a website, when administrator dblclick on the image so he can choose for a new one. I would complete with javascript but, I have no idea of doing this, the following code is html
& lt; Form action = "controller.php" Method = "post" class = "popupform" id = "form_changeillustration" encrypt = "multipart / form-data" & gt; & Lt; DL & gt; & Lt; Dt & gt; & Lt; Label = "newelustration" & gt; Choose a new photo: & lt; / Label & gt; & Lt; / Dt & gt; & Lt; Dd & gt; & Lt; Input type = "file" name = "novelty" id = "innovation" /> gt; & Lt; / Dd> & Lt; DT & gt; & Nbsp; & Lt; / Dt & gt; & Lt; Dd class = "buttonrow" & gt; & Lt; Input type = "hidden" name = "page" value = "{$ PAGE}" /> & Lt; Input type = "hidden" name = "module" value = "novelty" /> & Lt; Input type = "submit" class = "btnok" value = "edit" /> & Lt; Input type = "button" class = "btn cancellation" value = "cancel" /> & Lt; / Dd> & Lt; / DL & gt; & Lt; / Form & gt;
Here's an example of what you can do:
& lt ;! DOCTYPE html & gt; & Lt; Html & gt; & Lt; Top & gt; & Lt; Meta charset = "UTF-8" & gt; & Lt; Title & gt; Test & lt; / Title & gt; & Lt; / Head & gt; & Lt; Body & gt; & Lt; P & gt; & Lt; Img src = "picture / moi.jpg" alt = "" id = "picture" /> gt; & Lt; / P & gt; & Lt; P style = "display: none;" & Gt; Input gt; & Lt; / P & gt; & Lt; Script type = "text / javascript" & gt; Window.addEventListener ('load', function () {var image = document.getElementById ('image'); var file = document.getElementById ('file'); image.addEventListener ('dblclick', function (). ();}, False); file.addEventListener ('change', function () {var fileToUpload = this.files [0]; console.log (fileToUpload);}, wrong);}, false); & Lt; / Script & gt; & Lt; / Body & gt; & Lt; / Html & gt; This only works in FF and IE (the .click () method, but the file object is not implemented in IE), so if your administrator's browser is FF Use the trick and then follow this doctor to upload your file:
Comments
Post a Comment