Exemplo n.º 1
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();
     }
 }
Exemplo n.º 2
0
				// $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
				
					$new_name = 'Videos'.GetSID(7);
					//$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
					}
			} else {
				$full_path = "";
			}
			
			$_POST = sanitize($_POST);
		    $photos = $_POST;
		    settype($photos,'object');
			VideoGallery::updateVideoGallery($photos,$full_path); 
			$success = "Videos Successfully Saved!";
			
			$updates = 'Update videos content';
  	    AdminAction::addAdminAction($_SESSION['admin_name'],$updates);
	}
Exemplo n.º 3
0
 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;
 }