MVC build Image/File Selector reference other CMS features

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.