php uploadify上傳檔案

快樂de饅頭發表於2017-01-17

一、下載和使用

下載地址:

http://www.uploadify.com/download/

文件地址:

http://www.uploadify.com/documentation/

下載後解壓找到index.php檔案,如下:

<!DOCTYPE HTML>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<title>UploadiFive Test</title>

<script src="http://libs.baidu.com/jquery/1.7.2/jquery.min.js"></script>
<script src="jquery.uploadify.min.js" type="text/javascript"></script>
<link rel="stylesheet" type="text/css" href="uploadify.css">
<style type="text/css">
body {
	font: 13px Arial, Helvetica, Sans-serif;
}
</style>
</head>

<body>
	<h1>Uploadify Demo</h1>
	<form>
		<div id="queue"></div>
		<input id="file_upload" name="file_upload" type="file" multiple="true">
	</form>

	<script type="text/javascript">
		<?php $timestamp = time();?>
		$(function() {
			$('#file_upload').uploadify({
				'formData'     : {
					'timestamp' : '<?php echo $timestamp;?>',
					'token'     : '<?php echo md5('unique_salt' . $timestamp);?>'
				},
				'swf'      : 'uploadify.swf',
				'uploader' : 'uploadify.php',
				'onUploadSuccess' : function(file, data, response) {
		            alert('The file ' + file.name + ' was successfully uploaded with a response of ' + response + ':' + data);
		        }
			});
		});
	</script>
</body>
</html>





















相關文章