javascript - Uploading images via two upload buttons -
I have found this. There is a provision for uploading an image (or an input button) and I need two. I tried to make a copy again at once, but what do I need to give the desired result?
Code:
& lt; Input type = "file" & gt; & Lt; Script src = "// ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> & Lt; Script src = "jquery.image.upload.preview.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; Upload (preview) ({callback: function (res) {res.after.empty ()) (res.img) {jpg} Res.after.append ($ ("
"), $ ( '& Lt; img & gt;', {"Src": res.img.src, "width": (res.img.width> 200)? "50": res.img.width}))} }}}}}) & Lt; / Script & gt; & Lt; Input type = "file" & gt; & Lt; Script src = "// ajax.googleapis.com/ajax/libs/jquery/1.9.1/jquery.min.js"></script> & Lt; Script src = "jquery.image.upload.preview.js" & gt; & Lt; / Script & gt; & Lt; Script type = "text / javascript" & gt; Upload (preview) ({callback: function (res) {res.after.empty ()) (res.img) {jpg} Res.after.append ($ ("
"), $ ( '& Lt; img & gt;', {"Src": res.img.src, "width": (res.img.width> 200)? "50": res.img.width}))} }}}}}) & Lt; / Script & gt;
and the JS file is as follows;
(function () {var __indexOf = [] .indexOf || function (item) {for (var I = 0, l = this.length; i & lt; l; i + +) {If I come back in this & amp; i [=] === item) I;} return -1;}; (function ($) {$ ["Fn"] ["upload Preview "] = {(" Type ": [" Image / JPEG "," Image / PNG "," Picture / GIF "," Callback ": Function () { }}, O); ["every"] (function () after {var, wrapper, wrapper = $ ("$ (This) [" wrap "] (wrapper); $ (this) [" as " "]" $ "(" "); = $ (" & lt; span & gt; $ (this) ["after"] (after); $ (this) ["" " ] ("Change", function () {var obj, reader, _ref; obj = []; Obj ["target"] = $ (This); Obj ["cover"] = wrapper; Obj ["before"] = before; obj ["after"] =; if (this.files & amp; amp ;; 0] & amp; amp; (_ref = this.files [0]. Type, __indexOf.call (o type, _rf)> = 0)) {reader = new fileReader (); reader.odo = function (E) {var img; img = new image (); img.load = function () {returns o ["callback"] (obje); }; Img.src = e.target.result; Return obj ["img"] = img; }; Return Reader ReadAsDataURL (this.files [0]); } Other {Returns O ["Callback"] (OBJ); }}); }); $ (This) ["trigger"] ("change"); This return; }; This return; }) (JQuery); .}) Call (this);
Comments
Post a Comment