Modul Medienpoupload - output


/ Published in: PHP
Save to your folder(s)



Copy this code and paste it in your HTML
  1. <?php
  2. // Was ist denn nun zu tun? ----------------------------------------------------
  3. if ($_GET['FORM']['pwd'] == 1) {
  4. //Formular für "Passwort vergessen" anzeigen
  5. $func = 1;
  6. }
  7. elseif ($_POST['FORM']['pwdsnd'] == 1) {
  8. // Wenn Feld email gefüllt dann Kennwort senden (2),
  9. // sonst Formular für "PWD vergessen" (1)
  10. $email = $_POST['email'];
  11. $func = (empty($email)?1:2);
  12. }
  13. elseif (!$_SESSION['USR'] OR $_GET['FORM']['LOGOUT'] == 1) {
  14. // Login: Name und Kennwort eingeben
  15. $func = 5;
  16. }
  17. else
  18. {
  19. $_SESSION['catid'] = "REX_VALUE[1]";
  20. $_SESSION['rex'] = $REX;
  21. ?>
  22. <h2>Eigene F&auml;lle hochladen</h2>
  23.  
  24. <p>Bitte geben Sie zuerst eine knappe Beschreibung für die Datei ein, die Sie hochladen wollen. Anschließend können Sie mit Hilfe der Schaltfläche 'Upload' eine Datei auswählen und hochladen.</p><p></p>
  25.  
  26. <script type="text/javascript" src="files/swfupload/swfupload.js"></script>
  27. <script type="text/javascript" src="files/swfupload/jquery.swfupload.js"></script>
  28. <script type="text/javascript">
  29. /* <![CDATA[ */
  30. function hidediv(id)
  31. {
  32. if (document.getElementById)
  33. { // DOM3 = IE5, NS6
  34. document.getElementById(id).style.display = 'none';
  35. }
  36. else
  37. {
  38. if (document.layers)
  39. { // Netscape 4
  40. document.id.display = 'none';
  41. }
  42. else
  43. { // IE 4
  44. document.all.id.style.display = 'none';
  45. }
  46. }
  47. }
  48.  
  49. function showdiv(id)
  50. {
  51. if (document.getElementById)
  52. { // DOM3 = IE5, NS6
  53. document.getElementById(id).style.display = 'block';
  54. }
  55. else
  56. {
  57. if (document.layers)
  58. { // Netscape 4
  59. document.id.display = 'block';
  60. }
  61. else
  62. { // IE 4
  63. document.all.id.style.display = 'block';
  64. }
  65. }
  66. }
  67.  
  68. $(function(){
  69. $('#swfupload-control').swfupload({
  70. upload_url: "files/swfupload/upload.php",
  71. //post_params: {"sid" : "<?php echo session_id(); ?>" }, // "catid" : "<?php echo "REX_VALUE[1]"; ?>"
  72. file_size_limit : "10240",
  73. file_types : "*.doc;*.docx;*.pdf;*.jpg;*.jpeg;*.zip",
  74. file_types_description : "E-Learning Dateien",
  75. file_upload_limit : "0",
  76. flash_url : "files/swfupload/swfupload.swf",
  77. button_image_url : 'files/swfupload/XPButtonUploadText_61x22.png',
  78. button_width : 61,
  79. button_height : 22,
  80. button_placeholder : $('#button')[0],
  81. debug: false,
  82. custom_settings : {something : "here"}
  83. })
  84. .bind('swfuploadLoaded', function(event){
  85. $('#log').append('<li>Loaded</li>');
  86. })
  87. .bind('fileQueued', function(event, file){
  88. $('#log').append('<li>File queued - '+file.name+'</li>');
  89. // start the upload since it's queued
  90. //$(this).swfupload('setPostParams', {"sid" : "<?php echo session_id(); ?>", "fd" : document.uploadform.filedescription.value });
  91. try {
  92. var txtComment = document.getElementById('fd');
  93. $(this).swfupload('setPostParams', {"sid" : "<?php echo session_id(); ?>", "fd" : txtComment.value });
  94. } catch (e) { }
  95. $(this).swfupload('startUpload');
  96. })
  97. .bind('fileQueueError', function(event, file, errorCode, message){
  98. $('#log').append('<li>File queue error - '+message+'</li>');
  99. })
  100. .bind('fileDialogStart', function(event){
  101. $('#log').append('<li>File dialog start</li>');
  102. })
  103. .bind('fileDialogComplete', function(event, numFilesSelected, numFilesQueued){
  104. $('#log').append('<li>File dialog complete</li>');
  105. })
  106. .bind('uploadStart', function(event, file){
  107. $('#log').append('<li>Upload start - '+file.name+'</li>');
  108. showdiv('uploading');
  109. var lblProgress = document.getElementById('uploading');
  110. lblProgress.innerHTML = 'Datei wird gerade hochgeladen...';
  111. document.body.style.cursor = 'wait';
  112. })
  113. .bind('uploadProgress', function(event, file, bytesLoaded){
  114. $('#log').append('<li>Upload progress - '+bytesLoaded+'</li>');
  115. try {
  116. var percent = Math.ceil((bytesLoaded / file.size) * 100)
  117. var lblProgress = document.getElementById('uploading');
  118. lblProgress.innerHTML = 'Datei wird gerade hochgeladen... (' + percent + '%)';
  119. } catch (e) { }
  120. })
  121. .bind('uploadSuccess', function(event, file, serverData){
  122. $('#log').append('<li>Upload success - '+file.name+'</li>');
  123. document.body.style.cursor = 'default';
  124. try {
  125. var lblProgress = document.getElementById('uploading');
  126. lblProgress.innerHTML = 'Fertig.';
  127. } catch (e) { }
  128.  
  129. })
  130. .bind('uploadComplete', function(event, file){
  131. $('#log').append('<li>Upload complete - '+file.name+'</li>');
  132. // upload has completed, lets try the next one in the queue
  133. $(this).swfupload('startUpload');
  134. hidediv('uploading');
  135. //window.location.reload(true);
  136. //location.href = '<?php echo "http://".$_SERVER['HTTP_HOST']."/".rex_getUrl($this->getValue('article_id'), $REX['CUR_CLANG']); ?>';
  137. location.href = '<?php echo "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']."?article_id=".$this->getValue('article_id'); ?>';
  138. })
  139. .bind('uploadError', function(event, file, errorCode, message){
  140. $('#log').append('<li>Upload error - '+message+'</li>');
  141. document.body.style.cursor = 'default';
  142. try {
  143. var lblProgress = document.getElementById('uploading');
  144. lblProgress.innerHTML = 'Fehler beim Hochladen der Datei: ' + message;
  145. } catch (e) { }
  146. });
  147. });
  148. /* ]]> */
  149. </script>
  150.  
  151. <div id="swfupload-control" class="facts" >
  152. <!-- <ol id="log"></ol> -->
  153. <!-- <form name="uploadform"> -->
  154. <div>Beschreibung der Datei:&nbsp;<input type="text" id="fd" name="filedescription" value=""/></div>
  155. <!-- </form> -->
  156. <div><input type="button" id="button" /><div id="uploading" style="display:none;">...</div></div>
  157.  
  158. </div>
  159.  
  160. <?php
  161. }
  162. ?>

URL: dzoi.de

Report this snippet


Comments

RSS Icon Subscribe to comments

You need to login to post a comment.