index.php
<title>UploadiFive Test</title> <script src="jquery.min.js" type="text/javascript"></script> <script src="jquery.uploadifive.min.js" type="text/javascript"></script> <link rel="stylesheet" type="text/css" href="uploadifive.css"> <style type="text/css"> body { font: 13px Arial, Helvetica, Sans-serif; } .uploadifive-button { float: left; margin-right: 10px; } #queue { border: 1px solid #E5E5E5; height: 177px; overflow: auto; margin-bottom: 10px; padding: 0 3px 3px; width: 300px; } </style> </head> <body> <h1>UploadiFive Demo</h1> <form> <div id="queue"></div> <input id="file_upload" name="file_upload" type="file" multiple="true"> <a style="position: relative; top: 8px;" href="java script:$('#file_upload').uploadifive('upload')">Upload Files</a> </form> <script type="text/javascript"> $(function() { $('#file_upload').uploadifive({ 'auto' : false, 'checkScript' : 'check-exists.php', 'formData' : { }, 'queueID' : 'queue', 'uploadScript' : 'uploadifive.php', 'onUploadComplete' : function(file, data) { console.log(data); } }); }); </script> </body> </html>
oraz uploadifive.php
<?php /* UploadiFive Copyright (c) 2012 Reactive Apps, Ronnie Garcia */ // Set the uplaod directory $uploadDir = '/uploads'; // Set the allowed file extensions $tempFile = $_FILES['Filedata']['tmp_name']; $uploadDir = $_SERVER['DOCUMENT_ROOT'] . $uploadDir; $targetFile = $uploadDir . $_FILES['Filedata']['name']; // Validate the filetype // Save the file } else { // The file type wasn't allowed } } ?>