欢迎来到天天文库
浏览记录
ID:37239651
大小:315.50 KB
页数:38页
时间:2019-05-20
《jQuery-File-Upload》由会员上传分享,免费在线阅读,更多相关内容在行业资料-天天文库。
1、SetupinstructionsSimpleversionusingtheprovidedexampleforwebsitesrunningPHPTheprovidedexampleworksoutoftheboxandonlyneedsonestepforyoutoaddittoyourPHPbasedwebsite:1.Downloadthepluginarchive,extractitanduploadtheextractedfolder(youmayrenameit)toyourserver.Visittheuploadedfolder's"example"directory-yo
2、ushouldseeafileuploadinterfacesimilartothedemo,allowingyoutouploadfilestoyourwebsite.Ifuploadingfilesdoesn'twork,makesurethatthefilesandthumbnailsdirectoriespermissionsallowyourserverwriteaccess.Note:TheprovidedPHPuploadhandlerallowsanyonetouploadfiles.Theuploadedfilesarealsoaccessibleforanyonetodo
3、wnload.Theeasiestwaytoaddsomekindofauthenticationsystemistoprotecttheexampledirectorybyadding.htaccessbasedpasswordprotection.SimpleversionusingtheprovidedexampleforwebsiteswithoutPHP1.Implementafileuploadhandleronyourplatform(Ruby,Python,Java,etc.)thathandlesnormalformbasedfileuploadsanduploaditto
4、yourserver.SeealsotheServer-sidespecifictutorialsontheDocumentationHomepage.2.Downloadandextractthepluginarchive.3.Editexample/index.htmlandadjusttheactionattributeoftheHTMLformelementtotheURLofyourcustomfileuploadhandler.Adjustthefileinputnameattributeifyouruploadhandlerrequiresanotherparameternam
5、eforthefileuploads.4.Editexample/application.jsandremovethemaxChunkSizeandcontinueAbortedUploadsoptions(theseoptionsrequiresupportforchunkeduploadsonserver-side).5.UploadthejQuery-File-Uploadfoldertoyourwebsite.1.Extendyourcustomserver-sideuploadhandlertoreturnaJSONresponseakintothefollowingoutput:
6、{"name":"picture.jpg","size":902604,"url":"/jQuery-File-Upload/example/files/picture.jpg","thumbnail":"/jQuery-File-Upload/example/thumbnails/picture.jpg"}Visittheuploadedfolder's"example"directory-youshouldseeafileuploadinterfacesimilartothedemo,allowingyoutouploadfilestoyourwebsite.Note:T
7、hefileuploadpluginmakesuseofiframesforbrowserslikeMicrosoftInternetExplorerandOpera,whichdonotyetsupportXMLHTTPRequestuploads.IframebaseduploadsrequireaContent-typeoftext/plainortext/htmlfortheJSONresponse-
此文档下载收益归作者所有
点击更多查看相关文章~~