/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
<?php // Was ist denn nun zu tun? ---------------------------------------------------- if ($_GET['FORM']['pwd'] == 1) { //Formular für "Passwort vergessen" anzeigen $func = 1; } elseif ($_POST['FORM']['pwdsnd'] == 1) { // Wenn Feld email gefüllt dann Kennwort senden (2), // sonst Formular für "PWD vergessen" (1) $email = $_POST['email']; } elseif (!$_SESSION['USR'] OR $_GET['FORM']['LOGOUT'] == 1) { // Login: Name und Kennwort eingeben $func = 5; } else { $_SESSION['catid'] = "REX_VALUE[1]"; $_SESSION['rex'] = $REX; ?> <h2>Eigene Fälle hochladen</h2> <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> <script type="text/javascript" src="files/swfupload/swfupload.js"></script> <script type="text/javascript" src="files/swfupload/jquery.swfupload.js"></script> <script type="text/javascript"> /* <![CDATA[ */ function hidediv(id) { if (document.getElementById) { // DOM3 = IE5, NS6 document.getElementById(id).style.display = 'none'; } else { if (document.layers) { // Netscape 4 document.id.display = 'none'; } else { // IE 4 document.all.id.style.display = 'none'; } } } function showdiv(id) { if (document.getElementById) { // DOM3 = IE5, NS6 document.getElementById(id).style.display = 'block'; } else { if (document.layers) { // Netscape 4 document.id.display = 'block'; } else { // IE 4 document.all.id.style.display = 'block'; } } } $(function(){ $('#swfupload-control').swfupload({ upload_url: "files/swfupload/upload.php", //post_params: {"sid" : "<?php echo session_id(); ?>" }, // "catid" : "<?php echo "REX_VALUE[1]"; ?>" file_size_limit : "10240", file_types : "*.doc;*.docx;*.pdf;*.jpg;*.jpeg;*.zip", file_types_description : "E-Learning Dateien", file_upload_limit : "0", flash_url : "files/swfupload/swfupload.swf", button_image_url : 'files/swfupload/XPButtonUploadText_61x22.png', button_width : 61, button_height : 22, button_placeholder : $('#button')[0], debug: false, custom_settings : {something : "here"} }) .bind('swfuploadLoaded', function(event){ $('#log').append('<li>Loaded</li>'); }) .bind('fileQueued', function(event, file){ $('#log').append('<li>File queued - '+file.name+'</li>'); // start the upload since it's queued //$(this).swfupload('setPostParams', {"sid" : "<?php echo session_id(); ?>", "fd" : document.uploadform.filedescription.value }); try { var txtComment = document.getElementById('fd'); $(this).swfupload('setPostParams', {"sid" : "<?php echo session_id(); ?>", "fd" : txtComment.value }); } catch (e) { } $(this).swfupload('startUpload'); }) .bind('fileQueueError', function(event, file, errorCode, message){ $('#log').append('<li>File queue error - '+message+'</li>'); }) .bind('fileDialogStart', function(event){ $('#log').append('<li>File dialog start</li>'); }) .bind('fileDialogComplete', function(event, numFilesSelected, numFilesQueued){ $('#log').append('<li>File dialog complete</li>'); }) .bind('uploadStart', function(event, file){ $('#log').append('<li>Upload start - '+file.name+'</li>'); showdiv('uploading'); var lblProgress = document.getElementById('uploading'); lblProgress.innerHTML = 'Datei wird gerade hochgeladen...'; document.body.style.cursor = 'wait'; }) .bind('uploadProgress', function(event, file, bytesLoaded){ $('#log').append('<li>Upload progress - '+bytesLoaded+'</li>'); try { var percent = Math.ceil((bytesLoaded / file.size) * 100) var lblProgress = document.getElementById('uploading'); lblProgress.innerHTML = 'Datei wird gerade hochgeladen... (' + percent + '%)'; } catch (e) { } }) .bind('uploadSuccess', function(event, file, serverData){ $('#log').append('<li>Upload success - '+file.name+'</li>'); document.body.style.cursor = 'default'; try { var lblProgress = document.getElementById('uploading'); lblProgress.innerHTML = 'Fertig.'; } catch (e) { } }) .bind('uploadComplete', function(event, file){ $('#log').append('<li>Upload complete - '+file.name+'</li>'); // upload has completed, lets try the next one in the queue $(this).swfupload('startUpload'); hidediv('uploading'); //window.location.reload(true); //location.href = '<?php echo "http://".$_SERVER['HTTP_HOST']."/".rex_getUrl($this->getValue('article_id'), $REX['CUR_CLANG']); ?>'; location.href = '<?php echo "http://".$_SERVER['HTTP_HOST'].$_SERVER['SCRIPT_NAME']."?article_id=".$this->getValue('article_id'); ?>'; }) .bind('uploadError', function(event, file, errorCode, message){ $('#log').append('<li>Upload error - '+message+'</li>'); document.body.style.cursor = 'default'; try { var lblProgress = document.getElementById('uploading'); lblProgress.innerHTML = 'Fehler beim Hochladen der Datei: ' + message; } catch (e) { } }); }); /* ]]> */ </script> <div id="swfupload-control" class="facts" > <!-- <ol id="log"></ol> --> <!-- <form name="uploadform"> --> <div>Beschreibung der Datei: <input type="text" id="fd" name="filedescription" value=""/></div> <!-- </form> --> <div><input type="button" id="button" /><div id="uploading" style="display:none;">...</div></div> </div> <?php } ?>
URL: dzoi.de