Guest User

Upload button Metabox for WordPress

a guest
Dec 9th, 2010
303
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.63 KB | None | 0 0
  1. /*dataset Upload Form*/
  2.     $dataset_upload_folder = '/wp-content/blogs.dir/' . $blog_id . '/files/dataset';
  3.     $dataset = new metabox('dataset');
  4.     $dataset->title = 'Dataset Upload';
  5.     $dataset->categories = '9';
  6.     $dataset->html = <<<HEREHTML
  7.     <p class="message">&nbsp;</p>
  8.     <label for="datasetLoc">Location</label>
  9.     <input type="text" name="datasetLoc" id="datasetLoc" value="" />
  10.     <p>Location of zip file for dataset download.</p>
  11.     <span id="dataset-browse">&nbsp;</span>
  12.  
  13.     <script type="text/javascript" src="$uploadifyRoot/uploadify/swfobject.js"></script>
  14.     <script type="text/javascript" src="$uploadifyRoot/uploadify/jquery.uploadify.v2.1.0.min.js"></script>
  15.     <script type="text/javascript">
  16.         jQuery(document).ready(function($) {
  17.             var uploadifyRoot = "$uploadifyRoot/uploadify/"
  18.             jQuery('#dataset-browse').uploadify({
  19.                 'uploader'  : uploadifyRoot + 'uploadify.swf',
  20.                 'script'    : uploadifyRoot + 'uploadify.php',
  21.                 'cancelImg' : uploadifyRoot + 'cancel.png',
  22.                 'auto'      : true,
  23.                 'folder'    : '$dataset_upload_folder',
  24.                 'checkScript' : uploadifyRoot + 'check.php',
  25.                 'fileDesc' : 'File Description',
  26.                 'onError' : function(event, queueID, fileObj, errorObj, reposnse, data) {
  27.                     jQuery('#dataset .message').text('Error: ' + errorObj.type + ' ' + errorObj.info);
  28.                 },
  29.                 'onComplete': function(event, queueID, fileObj, reposnse, data) {
  30.                     jQuery('#dataset #datasetLoc').attr('value', '$site_url' + '/files/dataset/' + fileObj.name);
  31.                     jQuery('#dataset .message').hide().text('Success!').fadeIn('slow').fadeTo(5000, 1).fadeOut('slow');
  32.                 }
  33.             });
  34.         });
  35.         </script>
  36. HEREHTML;
Advertisement
Add Comment
Please, Sign In to add comment