The implementation results are as follows
Click to select a picture, pop up an iframe box
Top default picture root directory, followed by file list
The bottom is the selected file address, as well as uploading new pictures and files
Load IFrame Call JS method
function Initfiles (path) {if(Path = =spath) { $("#fback"). AddClass ("Hidden"); } Else { $("#fback"). Removeclass ("Hidden"); } varCollsum =5, Tbody = $ ("#tables > Tbody"), Tdata = $ ("#tlist"); $.post ("/fytadmin/filemiam/getfiledata", {Path:path}, function (res) {if(Res. Status = ="y") { if(Res. Data = =""|| Res. Data = =NULL) {Dig.alerterror ("Tips","There are no files in this directory! "); Openparentfolder (); } Else{tbody.empty (); Tdata.tmpl (Res. Data). AppendTo ('#trows'); $(". Table"). colresizable (); } } Else{dig.alerterror ("Error Hints", Res. MSG); } }, "JSON"); }
Server to read the file according to the address in the list to return JSON, where the code is not posted, a lot of online
Single File upload, button to call the file text box change method, using the Jquery.form plug-in implementation of file upload
signupfile:function (upinput) {varIsimg = $ ('input[name= "Filestype"]:checked'). Val (); varSuburl ="/fytadmin/filemiam/signupfile?isthum=0&upfiles=fileurl&isimg="+isimg; $("#forms"). Ajaxsubmit ({beforesubmit:function () {$ (". Sign-up"). attr ("Disabled","Disabled"). HTML ("uploading ..."); }, Success:function (data) {if(Data. Status = ="y") { $("#fileUrl"). val (data. Data); } Else{dig.alerterror ("message", data. MSG); } $(". Sign-up"). attr ("Disabled",false). HTML ("Single File Upload"); $("#fileUp"). Unbind (); }, Error:function (e) {$ (". Sign-up"). attr ("Disabled",false). HTML ("Single File Upload"); Console.log (e); }, Url:suburl, type:"Post", DataType:"JSON", timeout:600000 }); }
I will not write the other, if need to add group to find me 86594082
Later, I will put this project deployment server for your reference, the source for the moment not to discuss sharing, and later,
Ladies and gentlemen, Ann.
MVC build Image/File Selector reference other CMS features