init
This commit is contained in:
43
modules/EcmDocumentTemplates/FileUpload.php
Executable file
43
modules/EcmDocumentTemplates/FileUpload.php
Executable file
@@ -0,0 +1,43 @@
|
||||
<?php
|
||||
|
||||
class FileUpload {
|
||||
|
||||
var $name;
|
||||
var $toPath;
|
||||
var $newName;
|
||||
var $location;
|
||||
|
||||
function upload_file($name, $toPath, $newName="") {
|
||||
$file_tmp_name = $_FILES[$name]['tmp_name'];
|
||||
$file_name = $_FILES[$name]['name'];
|
||||
$file_size = $_FILES[$name]['size'];
|
||||
if(is_uploaded_file($file_tmp_name)) {
|
||||
$ext = strtolower(substr(strrchr($file_name, "."),1));
|
||||
while(file_exists($p = $toPath.create_guid().".".$ext));
|
||||
move_uploaded_file($file_tmp_name, $p);
|
||||
}
|
||||
return $p;
|
||||
}
|
||||
|
||||
function getFormHTML($ajax = true) {
|
||||
$html = '';
|
||||
if($ajax == true) {
|
||||
$html = '<iframe src="index.php?module=EcmDocumentTemplates&action=FileUpload&to_pdf=1&file=dfs">Yours browser not accept iframes!</iframe>';
|
||||
} else {
|
||||
}
|
||||
return $html;
|
||||
}
|
||||
|
||||
};
|
||||
|
||||
if(isset($_REQUEST['form']) && $_REQUEST['form']!='') {
|
||||
echo '<form name="FileUpload" action="index.php" enctype="multipart/form-data">
|
||||
<input type="hidden" name="module" value="EcmDocumentTemplates" />
|
||||
<input type="hidden" name="action" value="FileUpload" />
|
||||
<input type="hidden" name="to_pdf" value="1" />
|
||||
<input type="file" id="logo_image" name="logo_image" value="" />
|
||||
</form>
|
||||
';
|
||||
}
|
||||
|
||||
?>
|
||||
Reference in New Issue
Block a user