Location: PHPKode > projects > WikyBlog > include/tool/UploadForm.php
<?php
defined('WikyBlog') or die('Not an entry point...');


class uploadForm{
	
	function uploadForm(){
		global $page, $pageOwner, $langA, $max_upload, $jsNum;
		
		$page->scripts[] = '/include/js/fileManager.js?'.$jsNum;
		//$page->scripts[] = '/include/js/editing.js?'.$jsNum;
		$page->scripts[] = '/include/js/editingAll.js?'.$jsNum;

		
		$page->autoForm = true;
		$page->formEnc= 'multipart/form-data';
		$page->css2 = true;

		$page->regLink($langA['image_manager'],'/Special/'.$pageOwner['username'].'/ImageManager');
		$page->regLink($langA['file_manager'],'/Special/'.$pageOwner['username'].'/FileManager');
		$contentUri = $page->regLink($langA['file_upload'],'/Attach/'.$pageOwner['username'].'?cmd=uploadform');
		$page->regLink('?',$langA['upload_files'].'?en=Upload_Files');

		ob_start();
		echo '<p>';
		echo $langA['UPLOAD_INTRO'];
		echo '</p>';
		
		echo '<input type="hidden" name="MAX_FILE_SIZE" value="'.$max_upload.'" />';
		
		echo '<br/>';
		echo '<table class="WBeditArea1"  width="100%" cellpadding="7">';
		
		echo '<tr><td>';
		echo '<table cellpadding="7">';
		echo '<tr><td><b>';
		echo $langA['files'];
		echo '</b></td>';
		echo '<td>';
		
			echo '<table cellpadding="7"><tbody>';
			
			echo '<tr><td>';
			echo '<input type="file" name="userfile[]" onchange="wbUL.addFile(this)" />';
			echo '</td></tr>';
			
			echo '<tr style="display:none"><td>';
			echo '<input type="file" name="userfile[]" onchange="wbUL.addFile(this)" />';
			echo '</td></tr>';
			
			echo '<tr style="display:none"><td>';
			echo '<input type="file" name="userfile[]" onchange="wbUL.addFile(this)" />';
			echo '</td></tr>';
			
			echo '<tr style="display:none"><td>';
			echo '<input type="file" name="userfile[]" onchange="wbUL.addFile(this)" />';
			echo '</td></tr>';
			
			echo '<tr style="display:none"><td>';
			echo '<input type="file" name="userfile[]" onchange="wbUL.addFile(this)" />';
			echo '</td></tr>';
						
			echo '</tbody></table>';

			
		echo '</td></tr>';
		
		
		if( function_exists('gzencode') || function_exists('bzcompress') ){
			echo '<tr><td><b>';
			echo $langA['compression'];
			echo '</b>';
			echo '</td>';
			echo '<td>';
						
				if( function_exists('gzencode') ){
					echo '<label><input type="radio" name="compress" value="gz" /> GZip</label> <br/>';
				}elseif( function_exists('bzcompress') ){
					echo '<label><input type="radio" name="compress" value="bz" />  BZ</label> <br/>';
				}
				echo '<label><input type="radio" name="compress" value="" checked="checked" /> '.$langA['none'].'</label>';
			echo '</td></tr>';
		}
		
//		NOT WORKING, AND NOT IDEAL TO ALLOW JUST ANYONE OVERWRITE A FILE
// 		echo '<tr><td><b>';
// 		echo $langA['overwrite_existing'];
// 		echo '</b></td>';
// 		echo '<td>';
// 			if( isset($_POST['overwrite']) ){
// 				echo '<input type="checkbox" name="overwrite" value="true" checked="checked" />';
// 			}else{
// 				echo '<input type="checkbox" name="overwrite" value="true" />';
// 			}
// 		echo '</td></tr>';
		
		echo '</table>';

		
		echo '</table>';
		
		includeFile('tool/EditPage.php');
		$upload = '<input type="submit" name="cmd" value="'.$langA['upload'].'" class="WBbutton" title="'.$langA['upload'].'" onclick="WBe.set(false)"/>';
		echo saveBar(true,$upload,false,true,false);
		
		$page->contentB[$contentUri] = wb::get_clean();
	}
}

new uploadForm();
Return current item: WikyBlog