public function postAction()
 {
     if (!Mage::helper('customer')->isLoggedIn()) {
         Mage::app()->getFrontController()->getResponse()->setRedirect(Mage::getUrl('customer/account/create'));
     } else {
         //die(var_dump($_FILES));
         $userid = Mage::getSingleton('customer/session')->getCustomer()->getId();
         include Mage::getBaseDir('lib') . "/easy_upload/upload_class.php";
         //classes is the map where the class file is stored
         $max_size = 1024 * 100;
         // the max. size for uploading
         $upload = new file_upload();
         $upload->upload_dir = Mage::getBaseDir('media') . DS . 'surgery' . DS;
         $upload->extensions = array('.png', '.jpg', '.gif', '.tiff');
         // specify the allowed extensions here
         $upload->rename_file = true;
         if (!empty($_FILES)) {
             $upload->the_temp_file = $_FILES['userfile']['tmp_name'];
             $upload->the_file = $_FILES['userfile']['name'];
             $ext = strtolower(strrchr($_FILES['userfile']['name'], '.'));
             $upload->http_error = $_FILES['userfile']['error'];
             $upload->do_filename_check = 'y';
             // use this boolean to check for a valid filename
             $imagename = $userid . '_' . $this->generate_random_string();
             if ($upload->upload($imagename)) {
                 echo '<div id="status">success</div>';
                 echo '<div id="message">Successfully Uploaded</div>';
                 //return the upload file
                 echo '<div id="uploadedfile">' . $_FILES['upload']['name'] . '</div>';
                 $this->save_in_db($userid, $imagename . $ext);
             } else {
                 echo '<div id="status">failed</div>';
                 echo '<div id="message">' . $upload->show_error_string() . '</div>';
             }
         }
     }
     // if user logged in
 }
Exemple #2
0
 function agregaArchivo($tipoAyuda)
 {
     try {
         include_once "../../include/db/ConnectionHandler.php";
         include "../../config.php";
         include "../../include/upload/upload_class.php";
         $db = new ConnectionHandler("../..");
         $db->conn->SetFetchMode(ADODB_FETCH_ASSOC);
         $sql = "select * from anexos_tipo";
         $rs = $db->conn->Execute($sql);
         while (!$rs->EOF) {
             $ext[] = "." . $rs->fields["ANEX_TIPO_EXT"];
             $rs->moveNext();
         }
         $my_upload = new file_upload();
         $my_upload->language = "es";
         $my_upload->extensions = $ext;
         //$my_upload->upload_dir = "../$carpetaBodega/tmp/"; // "files" is the folder for the uploaded files (you have to create this folder)
         $my_upload->max_length_filename = 100;
         // change this value to fit your field length in your database (standard 100)
         $newFile = trim(ucwords(strtolower($_FILES['filePlantilla']['name'])));
         $uploadDir = "../../{$carpetaBodega}/Ayuda/" . strtolower($this->arrayTpAyuda[$tipoAyuda]) . "/";
         $my_upload->upload_dir = $uploadDir;
         $my_upload->the_temp_file = $_FILES['filePlantilla']['tmp_name'];
         $my_upload->the_file = $newFile;
         $my_upload->http_error = $_FILES['filePlantilla']['error'];
         $my_upload->do_filename_check = isset($_POST['check']) ? $_POST['check'] : "n";
         // use this boolean to check for a valid filename
         if ($i == 0) {
             if ($my_upload->upload($newFile)) {
                 // new name is an additional filename information, use this to rename the uploaded file
                 $full_path = $my_upload->upload_dir . $my_upload->file_copy;
                 $info = $my_upload->get_uploaded_file_info($full_path);
                 // ... or do something like insert the filename to the database
             } else {
                 $this->error = "<table width='31%' align='center' cellpadding='0' cellspacing='5' class='borde_tab'><tr><td class=titulosError>Ocurri&oacute un error al subir el archivo: <p>" . $my_upload->show_error_string() . "<br><blockquote>" . nl2br($info) . "</blockquote></td></tr></table>";
             }
         } else {
             if (!is_dir($uploadDir)) {
                 if (mkdir($uploadDir, 0777, true)) {
                     copy($full_path, $uploadDir . $newFile);
                 }
             } else {
                 copy($full_path, $uploadDir . $newFile);
             }
         }
     } catch (Exception $e) {
         $this->error = "Ocurri&oacute un error al subir el archivo: " . $e->getMessage();
     }
 }
 function upload()
 {
     $response = $this->response;
     $form = $response->get_form('upload', 'true');
     $form->box_css = 'htmlobject_box';
     $form->display_errors = false;
     $submit = $form->get_elements('submit');
     $submit->handler = 'onclick="wait();"';
     $form->add($submit, 'submit');
     $d['upload_1']['label'] = $this->lang['public_key'];
     $d['upload_1']['object']['type'] = 'input';
     $d['upload_1']['object']['attrib']['type'] = 'file';
     $d['upload_1']['object']['attrib']['name'] = 'upload_1';
     $d['upload_1']['object']['attrib']['size'] = 30;
     $d['upload_2']['label'] = $this->lang['server_license'];
     $d['upload_2']['object']['type'] = 'input';
     $d['upload_2']['object']['attrib']['type'] = 'file';
     $d['upload_2']['object']['attrib']['name'] = 'upload_2';
     $d['upload_2']['object']['attrib']['size'] = 30;
     $d['upload_3']['label'] = $this->lang['client_license'];
     $d['upload_3']['object']['type'] = 'input';
     $d['upload_3']['object']['attrib']['type'] = 'file';
     $d['upload_3']['object']['attrib']['name'] = 'upload_3';
     $d['upload_3']['object']['attrib']['size'] = 30;
     $form->add($d);
     if (!$form->get_errors() && $response->submit()) {
         $upload = new file_upload($this->openqrm->file());
         $upload->lang = $this->openqrm->user()->translate($upload->lang, $this->openqrm->get('basedir') . "/web/base/lang", 'file.upload.ini');
         $error = '';
         for ($i = 1; $i < 4; $i++) {
             if ($_FILES['upload_' . $i]['name'] !== '') {
                 $msg = $upload->upload('upload_' . $i, $this->openqrm->get('webdir') . '/tmp/', '', true);
                 if ($msg !== '') {
                     $error .= $msg['msg'] . '<br>';
                 }
             }
         }
         if ($error !== '') {
             $_REQUEST['upload_msg'] = $error;
         } else {
             $response_msg = array();
             for ($i = 1; $i < 4; $i++) {
                 if ($_FILES['upload_' . $i]['name'] !== '') {
                     $command = $this->openqrm->get('basedir') . "/bin/openqrm license -l " . $this->openqrm->get('webdir') . "/tmp/" . $_FILES['upload_' . $i]['name'] . " --openqrm-cmd-mode background";
                     $resource = new resource();
                     $resource->get_instance_by_id(0);
                     $resource->send_command($resource->ip, $command);
                     $response_msg[] = sprintf($this->lang['msg'], $_FILES['upload_' . $i]['name']);
                     sleep(4);
                 }
             }
             $response_msg = implode('<br>', $response_msg);
             $response->redirect($this->openqrm->get('baseurl') . '/index.php?datacenter_msg=' . $response_msg . '&upload_msg=' . $response_msg);
         }
     }
     $t = $this->response->html->template($this->openqrm->get('webdir') . '/tpl/upload.tpl.php');
     $t->add($response->html->thisfile, 'thisfile');
     $t->add($this->lang['label'], 'label');
     $t->add($this->lang['welcome'], 'welcome');
     $t->add($this->lang['explanation'], 'explanation');
     $t->add($form->get_elements());
     $t->group_elements(array('param_' => 'form'));
     $content['label'] = $this->lang['tab'];
     $content['value'] = $t;
     $content['target'] = $this->response->html->thisfile;
     $content['request'] = $this->response->get_array('upload', 'true');
     $content['onclick'] = false;
     $content['active'] = true;
     return $content;
 }
Exemple #4
0
include "../../../classes/Database.php";
include "../../../classes/Connection.php";
include_once "../../../includes/bootstrap.php";
include "../../../classes/VideoGallery.php";
include "../../../classes/AdminAction.php";
include "../../../includes/security.funcs.inc";
include "functions/myFunctions.php";
?>
<?
	if(isset($_POST['submit'])) {
		
			include ("upload_class.php"); //classes is the map where the class file is stored (one above the root)

			$max_size = 1024*250; // the max. size for uploading
		
			$my_upload = new file_upload;
		
			if($_FILES['image']['name'] != '') {
		
		
					$my_upload->upload_dir = "../../../videos/"; // "files" is the folder for the uploaded files (you have to create this folder)
					$my_upload->extensions = array(".jpeg", ".gif", ".bmp",".jpg",".png");// specify the allowed extensions here
				// $my_upload->extensions = "de"; // use this to switch the messages into an other language (translate first!!!)
					$my_upload->max_length_filename = 50; // change this value to fit your field length in your database (standard 100)
					$my_upload->rename_file = true;
				
					$my_upload->the_temp_file = $_FILES['image']['tmp_name'];
					$my_upload->the_file = $_FILES['image']['name'];
					$my_upload->http_error = $_FILES['image']['error'];
					$my_upload->replace = 'y';
					//$my_upload->replace = (isset($_POST['replace'])) ? $_POST['replace'] : "n"; // because only a checked checkboxes is true
//if (!$dependencia or !$nivelus)  include "./rec_session.php";
$causaAccion = "Asociar Imagen a Radicado";
?>
<body>
<br>
<?php 
/**
 * Aqui se intenta subir el archivo al sitio original
 *
 */
$ruta_raiz = "..";
include "{$ruta_raiz}/include/upload/upload_class.php";
//classes is the map where the class file is stored (one above the root)
$max_size = return_bytes(ini_get('upload_max_filesize'));
// the max. size for uploading
$my_upload = new file_upload();
$my_upload->language = "es";
$my_upload->upload_dir = "{$ruta_raiz}/bodega/tmp/";
// "files" is the folder for the uploaded files (you have to create this folder)
$my_upload->extensions = array(".tif", ".pdf");
// specify the allowed extensions here
//$my_upload->extensions = "de"; // use this to switch the messages into an other language (translate first!!!)
$my_upload->max_length_filename = 50;
// change this value to fit your field length in your database (standard 100)
$my_upload->rename_file = true;
if (isset($_POST['Realizar'])) {
    $tmpFile = trim($_FILES['upload']['name']);
    $newFile = $valRadio;
    $uploadDir = "{$ruta_raiz}/bodega/" . substr($valRadio, 0, 4) . "/" . substr($valRadio, 4, 3) . "/";
    $fileGrb = substr($valRadio, 0, 4) . "/" . substr($valRadio, 4, 3) . "/{$valRadio}" . "." . substr($tmpFile, -3);
    $my_upload->upload_dir = $uploadDir;
<?php
    define('_MEXEC', 'OK');
    require_once("../system/load.php");
    include("upload_class.php"); //classes is the map where the class file is stored

    $session = new Sessions();
    $upload = new file_upload();

    $upload->upload_dir = '../uploads/hotel-gal/';
    $upload->extensions = array('.png', '.jpg'); // specify the allowed extensions here
    $upload->rename_file = true;

    $image_list = array();

    $hotel_file_id = $_REQUEST['hotel_file_id'];

    if (!empty($_FILES) && $hotel_file_id != '') {
        $upload->the_temp_file = $_FILES['userfile']['tmp_name'];
        $upload->the_file = $_FILES['userfile']['name'];
        $upload->http_error = $_FILES['userfile']['error'];
        $upload->do_filename_check = 'y'; // use this boolean to check for a valid filename
        $upload->hotel_image_id = $hotel_file_id . '_' . $_FILES['userfile']['name'];

        if ($upload->upload()) {
            echo '<div id="status">success</div>';
            echo '<div id="message">' . $upload->file_copy . ' Successfully Uploaded</div>';
            //return the upload file
            echo '<div id="uploadedfile">' . $upload->file_copy . '</div>';
            //---------------thumbanail-------------------
            $src = "../uploads/hotel-gal/" . $upload->file_copy;
            $dest = "../uploads/hotels/thumbnails/" . $upload->file_copy;
<?php

//the default
//include ($_SERVER['DOCUMENT_ROOT']."/classes/upload/upload_class.php"); //classes is the map where the class file is stored (one above the root)
include "upload_class.php";
$max_size = 1024 * 250;
// the max. size for uploading
$my_upload = new file_upload();
$my_upload->upload_dir = $_SERVER['DOCUMENT_ROOT'] . "/files/new/";
// "files" is the folder for the uploaded files (you have to create this folder)
$my_upload->extensions = array(".png", ".zip", ".pdf");
// specify the allowed extensions here
// $my_upload->extensions = "de"; // use this to switch the messages into an other language (translate first!!!)
$my_upload->max_length_filename = 50;
// change this value to fit your field length in your database (standard 100)
$my_upload->rename_file = true;
if (isset($_POST['Submit'])) {
    $my_upload->the_temp_file = $_FILES['upload']['tmp_name'];
    $my_upload->the_file = $_FILES['upload']['name'];
    $my_upload->http_error = $_FILES['upload']['error'];
    $my_upload->replace = isset($_POST['replace']) ? $_POST['replace'] : "n";
    // because only a checked checkboxes is true
    $my_upload->do_filename_check = isset($_POST['check']) ? $_POST['check'] : "n";
    // use this boolean to check for a valid filename
    $new_name = isset($_POST['name']) ? $_POST['name'] : "";
    if ($my_upload->upload($new_name)) {
        // new name is an additional filename information, use this to rename the uploaded file
        $full_path = $my_upload->upload_dir . $my_upload->file_copy;
        $info = $my_upload->get_uploaded_file_info($full_path);
        // ... or do something like insert the filename to the database
    }
            foreach ($files as $val) {
                if (is_file($directory . $val)) {
                    $file_date[$val] = filemtime($directory . $val);
                }
            }
        }
    }
    closedir($handle);
    asort($file_date, SORT_NUMERIC);
    reset($file_date);
    $oldest = key($file_date);
    return $oldest;
}
$max_size = 1024 * 80 * 1024;
// the max. size for uploading
$my_upload = new file_upload();
$my_upload->upload_dir = $_SERVER['DOCUMENT_ROOT'] . "/files/";
// "files" is the folder for the uploaded files (you have to create this folder)
$my_upload->extensions = array(".png", ".zip", ".pdf", ".gif", ".bmp");
// specify the allowed extensions here
if (isset($_POST['Submit'])) {
    $my_upload->the_temp_file = $_FILES['upload']['tmp_name'];
    $my_upload->the_file = $_FILES['upload']['name'];
    $my_upload->http_error = $_FILES['upload']['error'];
    $my_upload->replace = isset($_POST['replace']) ? $_POST['replace'] : "n";
    $my_upload->do_filename_check = isset($_POST['check']) ? $_POST['check'] : "n";
    if ($my_upload->upload()) {
        $latest = get_oldest_file($folder);
        del_file($folder . $latest);
    }
}
Exemple #9
0
<?php

include $_SERVER['DOCUMENT_ROOT'] . "/classes/upload/upload_class.php";
//classes is the map where the class file is stored (one above the root)
$max_size = 1024 * 250;
// the max. size for uploading
$my_upload = new file_upload();
$my_upload->upload_dir = $_SERVER['DOCUMENT_ROOT'] . "/files/new/";
// "files" is the folder for the uploaded files (you have to create this folder)
$my_upload->extensions = array(".png", ".zip", ".pdf", ".jpg");
// specify the allowed extensions here
// $my_upload->extensions = "de"; // use this to switch the messages into an other language (translate first!!!)
$my_upload->max_length_filename = 50;
// change this value to fit your field length in your database (standard 100)
$my_upload->rename_file = true;
// You need to modify the settings below...
$conn = mysql_connect("localhost", "user", "pw") or die(mysql_error());
mysql_select_db("database", $conn) or die(mysql_error());
// the code to create the test table
mysql_query("\n\tCREATE TABLE IF NOT EXISTS file_table (\n\tid INT NOT NULL AUTO_INCREMENT,\n\tfile_name VARCHAR( 100 ) NOT NULL,\n\tPRIMARY KEY (id))") or die(mysql_error());
if (isset($_POST['Submit'])) {
    $my_upload->the_temp_file = $_FILES['upload']['tmp_name'];
    $my_upload->the_file = $_FILES['upload']['name'];
    $my_upload->http_error = $_FILES['upload']['error'];
    $my_upload->replace = "y";
    $my_upload->do_filename_check = "n";
    // use this boolean to check for a valid filename
    if ($my_upload->upload()) {
        // new name is an additional filename information, use this to rename the uploaded file
        mysql_query(sprintf("INSERT INTO file_table SET file_name = '%s'", $my_upload->file_copy));
    }
include "../../../classes/ProductsOption.php";
include "../../../classes/Options.php";
include "../../../classes/OptionsCategory.php";
include "../../../classes/AdminAction.php";
include "../../../includes/security.funcs.inc";
include_once "../../../includes/Pagination.php";
include_once 'thumbnail/thumbnail_images.class.php';
include_once 'functions/myFunctions.php';
$category_options = OptionsCategory::displayAllOptionsCategory();
$product_id = $_REQUEST['Id'];
if (isset($_POST['submit'])) {
    include "upload_class.php";
    //classes is the map where the class file is stored (one above the root)
    $max_size = 1024 * 250;
    // the max. size for uploading
    $my_upload = new file_upload();
    if ($_FILES['image']['name'] != '') {
        $my_upload->upload_dir = "../../../products_image/";
        // "files" is the folder for the uploaded files (you have to create this folder)
        $my_upload->extensions = array(".jpeg", ".gif", ".bmp", ".jpg", ".png");
        // specify the allowed extensions here
        // $my_upload->extensions = "de"; // use this to switch the messages into an other language (translate first!!!)
        $my_upload->max_length_filename = 50;
        // change this value to fit your field length in your database (standard 100)
        $my_upload->rename_file = true;
        $my_upload->the_temp_file = $_FILES['image']['tmp_name'];
        $my_upload->the_file = $_FILES['image']['name'];
        $my_upload->http_error = $_FILES['image']['error'];
        $my_upload->replace = 'y';
        //$my_upload->replace = (isset($_POST['replace'])) ? $_POST['replace'] : "n"; // because only a checked checkboxes is true
        //$my_upload->do_filename_check = (isset($_POST['check'])) ? $_POST['check'] : "n"; // use this boolean to check for a valid filename
 function upload()
 {
     $response = $this->get_response();
     $form = $response->form;
     $form->display_errors = true;
     $file_permission = $response->html->request()->get('permission');
     switch ($file_permission) {
         case 'private':
             $s3_permission = S3::ACL_PRIVATE;
             break;
         case 'public-read':
             $s3_permission = S3::ACL_PUBLIC_READ;
             break;
         case 'public-read-write':
             $s3_permission = ACL_PUBLIC_READ_WRITE;
             break;
         case 'authenticated-read':
             $s3_permission = ACL_AUTHENTICATED_READ;
             break;
         default:
             $s3_permission = S3::ACL_PRIVATE;
             break;
     }
     if (!$form->get_errors() && $this->response->submit()) {
         $errors = array();
         require_once $this->openqrm->get('webdir') . '/class/file.handler.class.php';
         require_once $this->openqrm->get('webdir') . '/class/file.upload.class.php';
         $file = new file_handler();
         $upload = new file_upload($file);
         $error = $upload->upload('upload', $this->openqrm->get('webdir') . '/tmp');
         if ($error !== '') {
             $response->error = 'Error uploading ' . $error['msg'] . ' - ' . $this->openqrm->get('webdir') . '/tmp';
         } else {
             $uploaded_file = $this->openqrm->get('basedir') . "/web/base/tmp/" . $_FILES['upload']['name'];
             $upload_name = basename($uploaded_file);
             $this->s3->putObject($this->s3->inputFile($uploaded_file, false), $this->bucket_name, $upload_name, $s3_permission);
             unlink($uploaded_file);
             $response->msg = 'uploaded ' . $uploaded_file;
         }
     }
     return $response;
 }
Exemple #12
0
 } else {
     foreach ($arFieldValues as $k => $v) {
         if ($k == 'id') {
             continue;
         }
         $arFieldValuesUpdate[$k] = $v;
     }
     $arConditions = array("id" => $id);
     $objPhotos->update($table, $arFieldValuesUpdate, $arConditions);
     $_SESSION['empMsg'] = "Photo Record Updated Successfully";
 }
 if (isset($_FILES['file_name']) && $_FILES['file_name']['name'] != "") {
     //require_once("../lib/class.image_upload.php");
     //require_once("../lib/class.image_resize.php");
     require "../lib/class.upload.php";
     $objUpload = new file_upload();
     $image_height = 320;
     $image_width = 400;
     $arfilename = $objUpload->upload($id, 'file_name', IMAGE_UPLOAD_PATH, 'jpeg,gif,png,JPG,JPEG,jpeg');
     $objUpload->smart_resize_image(IMAGE_UPLOAD_PATH . $arfilename[0], $image_width, $image_height, IMAGE_UPLOAD_PATH, false, $arfilename[0], true);
     $filename = $arfilename[0];
     /*
     $objImageupload	= new imageFileUpload();
     
     $objImageupload->tag_name = "file_name";
     
     $a_tempFileName  = explode(".",strtolower($_FILES['file_name']['name']));
      
     $objImageupload->file_name = $a_tempFileName[0].".".$a_tempFileName[1];
     
     $newFileName	=  $objImageupload->file_name;			
<?php

include_once $_SERVER['DOCUMENT_ROOT'] . "/classes/upload/upload_class.php";
include_once $_SERVER['DOCUMENT_ROOT'] . "/classes/attach_mailer/attach_mailer_class.php";
$error = '';
if (isset($_POST['Submit'], $_FILES['upload'])) {
    $my_mail = new attach_mailer('MyName', '*****@*****.**', '*****@*****.**', '', '', 'test mail multi att.');
    $my_mail->text_body = 'Hello World';
    $num_files = count($_FILES['upload']['name']);
    for ($i = 0; $i < $num_files; $i++) {
        if ($_FILES['upload']['name'][$i] != '') {
            $my_upload = new file_upload();
            $my_upload->upload_dir = $_SERVER['DOCUMENT_ROOT'] . "/files/multi/";
            $my_upload->extensions = array(".png", ".jpg", ".gif");
            $my_upload->the_temp_file = $_FILES['upload']['tmp_name'][$i];
            $my_upload->the_file = $_FILES['upload']['name'][$i];
            $my_upload->http_error = $_FILES['upload']['error'][$i];
            $my_upload->replace = "n";
            if ($my_upload->upload()) {
                $full_path = $my_upload->upload_dir . $my_upload->file_copy;
                $my_mail->add_attach_file($full_path);
                $error .= 'File &quot;' . $my_upload->file_copy . '&quot; uploaded<br />';
            } else {
                break;
                $error = 'Error uploading file(s)';
            }
        }
    }
    if ($my_mail->process_mail()) {
        $error .= 'Mail send!';
    } else {
 function image_upload($file)
 {
     if ($_FILES[$file]['name']) {
         $max_size = 100000 * 100000;
         // the max. size for uploading
         $upload_img = new file_upload();
         $upload_img->upload_dir = 'images/';
         // "files" is the folder for the uploaded files (you have to create this folder)
         $upload_img->extensions = array(".jpg");
         // specify the allowed extensions here
         $upload_img->max_length_filename = 1000;
         // change this value to fit your field length in your database (standard 100)
         $upload_img->rename_file = true;
         $upload_img->the_temp_file = $_FILES[$file]['tmp_name'];
         $upload_img->the_file = $_FILES[$file]['name'];
         $upload_img->http_error = $_FILES[$file]['error'];
         if ($upload_img->upload()) {
             // new name is an additional filename information, use this to rename the uploaded file
             $full_path = $upload_img->upload_dir . $upload_img->file_copy;
             $imagename = $upload_img->get_uploaded_file_info($full_path);
         }
     } else {
         $imagename = "";
     }
     return $imagename;
 }
Exemple #15
0
$response = $html->response();
$form = $response->get_form();
$form->box_css = 'htmlobject_box';
$form->display_errors = true;
$d['upload']['label'] = $lang['upload'];
$d['upload']['object']['type'] = 'input';
$d['upload']['object']['attrib']['type'] = 'file';
$d['upload']['object']['attrib']['name'] = 'upload';
$d['upload']['object']['attrib']['size'] = 30;
$form->add($html->thisfile, 'thisfile');
$form->add($d);
if (!$form->get_errors() && $response->submit()) {
    require_once $RootDir . 'class/file.handler.class.php';
    require_once $RootDir . 'class/file.upload.class.php';
    $file = new file_handler();
    $upload = new file_upload($file);
    $error = $upload->upload('upload', $RootDir . 'tmp');
    if ($error !== '') {
        $form->set_error('upload', $error['msg']);
    } else {
        $resource_command = $OPENQRM_SERVER_BASE_DIR . "/openqrm/bin/openqrm license -l " . $OPENQRM_SERVER_BASE_DIR . "/openqrm/web/base/tmp/" . $_FILES['upload']['name'] . " --openqrm-cmd-mode background";
        $resource = new resource();
        $resource->get_instance_by_id(0);
        $resource->send_command($resource->ip, $resource_command);
        $response_msg = sprintf($lang['msg'], $_FILES['upload']['name']);
        sleep(4);
        $response->redirect('/openqrm/base/index.php?datacenter_msg=' . $response_msg);
    }
}
$tpl = $html->template($RootDir . 'tpl/upload.tpl.php');
$tpl->add($html->thisurl, 'baseurl');
Exemple #16
0
<?php

include_once $_SERVER['DOCUMENT_ROOT'] . '/pathtotheclass/upload_class.php';
$error = '';
$image = '';
$copy_link = '';
if (isset($_POST['Submit'])) {
    $my_upload = new file_upload();
    $my_upload->upload_dir = $_SERVER['DOCUMENT_ROOT'] . "/modal-upload/files/";
    $my_upload->extensions = array(".png", ".jpg", ".gif");
    // allowed extensions
    $my_upload->rename_file = true;
    $my_upload->the_temp_file = $_FILES['upload']['tmp_name'];
    $my_upload->the_file = $_FILES['upload']['name'];
    $my_upload->http_error = $_FILES['upload']['error'];
    if ($my_upload->upload()) {
        $image = $my_upload->file_copy;
        $copy_link = ' | <a id="closelink" href="#" onclick="self.parent.tb_remove();">Pass file name</a>';
    }
    $error = $my_upload->show_error_string();
}
?>
<html>
<head>
<title>Image upload</title>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="jquery.min.js"></script>
<link rel="stylesheet" href="style.css" type="text/css" media="screen" />
<script type="text/javascript">
$(document).ready(function() {