气死人的 uploadify3.2.1 插件

来源:互联网 发布:《java编程思想》 下载 编辑:程序博客网 时间:2024/04/30 01:58

       uploadify插件的确是个好东西,但是对于像我这样才接触的人来说,确实被坑惨了。

       本来准备将uploadify用在ASP.NET MVC中试试,可是试了N久,没试个所以然来,这还是主要怪自己对MVC不熟悉。好吧,MVC 不行 Web Form 总该可以吧!

       因为自己今天才接触这个插件,所以更不就不清楚怎么用,官网上面的又是一个PHP的demo。。。确实没有办法,在网上搜了很久,才知道结合一般处理程序实现服务器端文件处理,其实这些都不是我主要想说的。我想说的是网上很对uploadify初始化的代码很有问题,比如:下面代码

$("#uploadify").uploadify({ 'uploader': 'JS/jquery.uploadify-v2.1.0/uploadify.swf','script': 'UploadHandler.ashx', 'cancelImg': 'JS/jquery.uploadify-v2.1.0/cancel.png', 'folder':'UploadFile','queueID':'fileQueue', 'auto':false, 'multi':true }); });

在这段代码中有的Option在3.2.1的版本中根本就没有...所以怎么用也得不到想要的结果...在3.2.1的版本中一般处理程序应该写在‘uploader’选项中,在文件上传之后就会进入一般处理程序对文件进行处理

也就是‘uploader’:'UploadHandler.ashx'


在3.2.1版本中有一下option,后面是它的默认值

// Required Settingsid       : $this.attr('id'), // The ID of the DOM objectswf      : 'uploadify.swf',  // The path to the uploadify SWF fileuploader : 'uploadify.php',  // The path to the server-side upload script// Optionsauto            : true,               // Automatically upload files when added to the queuebuttonClass     : '',                 // A class name to add to the browse button DOM objectbuttonCursor    : 'hand',             // The cursor to use with the browse buttonbuttonImage     : null,               // (String or null) The path to an image to use for the Flash browse button if not using CSS to style the buttonbuttonText      : 'SELECT FILES',     // The text to use for the browse buttoncheckExisting   : false,              // The path to a server-side script that checks for existing files on the serverdebug           : false,              // Turn on swfUpload debugging modefileObjName     : 'Filedata',         // The name of the file object to use in your server-side scriptfileSizeLimit   : 0,                  // The maximum size of an uploadable file in KB (Accepts units B KB MB GB if string, 0 for no limit)fileTypeDesc    : 'All Files',        // The description for file types in the browse dialogfileTypeExts    : '*.*',              // Allowed extensions in the browse dialog (server-side validation should also be used)height          : 30,                 // The height of the browse buttonitemTemplate    : false,              // The template for the file item in the queuemethod          : 'post',             // The method to use when sending files to the server-side upload scriptmulti           : true,               // Allow multiple file selection in the browse dialogformData        : {},                 // An object with additional data to send to the server-side upload script with every file uploadpreventCaching  : true,               // Adds a random value to the Flash URL to prevent caching of it (conflicts with existing parameters)progressData    : 'percentage',       // ('percentage' or 'speed') Data to show in the queue item during a file uploadqueueID         : false,              // The ID of the DOM object to use as a file queue (without the #)queueSizeLimit  : 999,                // The maximum number of files that can be in the queue at one timeremoveCompleted : true,               // Remove queue items from the queue when they are done uploadingremoveTimeout   : 3,                  // The delay in seconds before removing a queue item if removeCompleted is set to truerequeueErrors   : false,              // Keep errored files in the queue and keep trying to upload themsuccessTimeout  : 30,                 // The number of seconds to wait for Flash to detect the server's response after the file has finished uploadinguploadLimit     : 0,                  // The maximum number of files you can uploadwidth           : 120,                // The width of the browse button