氣死人的 uploadify3.2.1 插件

       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 Settings
					id       : $this.attr('id'), // The ID of the DOM object
					swf      : 'uploadify.swf',  // The path to the uploadify SWF file
					uploader : 'uploadify.php',  // The path to the server-side upload script
					
					// Options
					auto            : true,               // Automatically upload files when added to the queue
					buttonClass     : '',                 // A class name to add to the browse button DOM object
					buttonCursor    : 'hand',             // The cursor to use with the browse button
					buttonImage     : null,               // (String or null) The path to an image to use for the Flash browse button if not using CSS to style the button
					buttonText      : 'SELECT FILES',     // The text to use for the browse button
					checkExisting   : false,              // The path to a server-side script that checks for existing files on the server
					debug           : false,              // Turn on swfUpload debugging mode
					fileObjName     : 'Filedata',         // The name of the file object to use in your server-side script
					fileSizeLimit   : 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 dialog
					fileTypeExts    : '*.*',              // Allowed extensions in the browse dialog (server-side validation should also be used)
					height          : 30,                 // The height of the browse button
					itemTemplate    : false,              // The template for the file item in the queue
					method          : 'post',             // The method to use when sending files to the server-side upload script
					multi           : true,               // Allow multiple file selection in the browse dialog
					formData        : {},                 // An object with additional data to send to the server-side upload script with every file upload
					preventCaching  : 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 upload
					queueID         : 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 time
					removeCompleted : true,               // Remove queue items from the queue when they are done uploading
					removeTimeout   : 3,                  // The delay in seconds before removing a queue item if removeCompleted is set to true
					requeueErrors   : false,              // Keep errored files in the queue and keep trying to upload them
					successTimeout  : 30,                 // The number of seconds to wait for Flash to detect the server's response after the file has finished uploading
					uploadLimit     : 0,                  // The maximum number of files you can upload
					width           : 120,                // The width of the browse button



發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章