2011-05-06 11:33:27 +00:00
|
|
|
<?php
|
|
|
|
|
require("_incl/upload.class.php");
|
|
|
|
|
|
|
|
|
|
function limpia($imagen){
|
|
|
|
|
if(file_exists($imagen)) {
|
|
|
|
|
unlink($imagen);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function uploadImagenProducto($prodID, $size1_w, $size1_h, $size2_w=0, $size2_h=0, $mascara='') {
|
|
|
|
|
$path = "../../_prds/"; // este directorio tiene que tener chmod 777
|
|
|
|
|
$upload_file_name = "prod_imagen"; // el nombre del campo tipo file de nuestro formulario
|
|
|
|
|
$acceptable_file_types = "image/gif|image/jpeg|image/pjpeg"; // acepta GIF et JPEG
|
|
|
|
|
$default_extension = "";
|
|
|
|
|
$mode = 1; // OPTIONS:
|
|
|
|
|
// 1 = overwrite mode
|
|
|
|
|
// 2 = create new with incremental extention
|
|
|
|
|
// 3 = do nothing if exists, highest protection
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// un poco de limpieza previa
|
|
|
|
|
// este es el temporal
|
|
|
|
|
$glob = glob($path . $proid, '_tmp');
|
|
|
|
|
limpia($glob);
|
|
|
|
|
|
|
|
|
|
limpia($path . '_' . $size1_w . '.jpg');
|
|
|
|
|
limpia($path . '_' . $size2_w . '.jpg');
|
|
|
|
|
// fin de la limpia
|
|
|
|
|
|
|
|
|
|
if(strlen($_FILES['prod_imagen']['name'])) {
|
|
|
|
|
$my_uploader = new uploader('es'); // Create a new instance of the class
|
|
|
|
|
$my_uploader->max_filesize(150000); // OPTIONAL: set the max filesize of uploadable files in bytes
|
|
|
|
|
$my_uploader->max_image_size(1600, 1600); // OPTIONAL: if you're uploading images, you can set the max pixel dimensions
|
|
|
|
|
// UPLOAD the file
|
|
|
|
|
if ($my_uploader->upload($upload_file_name, $acceptable_file_types, $default_extension)) {
|
|
|
|
|
$my_uploader->save_file($path, $prodID . '_tmp', $mode);
|
|
|
|
|
if (!$my_uploader->error) {
|
|
|
|
|
$my_uploader->resize($prodID . '_' . $size1_w . '.jpg', $size1_w, $size1_h, 60);
|
|
|
|
|
if($size2_w) {
|
|
|
|
|
$my_uploader->resize($prodID . '_' . $size2_w . '.jpg', $size2_w, $size2_h, 60);
|
|
|
|
|
}
|
|
|
|
|
$my_uploader->delete_file;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ($my_uploader->error) {
|
|
|
|
|
echo $my_uploader->error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$glob = glob($path . $proid, '_tmp');
|
|
|
|
|
limpia($glob);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-09 15:07:48 +00:00
|
|
|
function uploadImagenOcasion($prodID, $size1_w, $size1_h, $size2_w=0, $size2_h=0, $mascara='') {
|
|
|
|
|
$path = "../../_ocs/"; // este directorio tiene que tener chmod 777
|
|
|
|
|
$upload_file_name = "prod_imagen"; // el nombre del campo tipo file de nuestro formulario
|
|
|
|
|
$acceptable_file_types = "image/gif|image/jpeg|image/pjpeg"; // acepta GIF et JPEG
|
|
|
|
|
$default_extension = "";
|
|
|
|
|
$mode = 1; // OPTIONS:
|
|
|
|
|
// 1 = overwrite mode
|
|
|
|
|
// 2 = create new with incremental extention
|
|
|
|
|
// 3 = do nothing if exists, highest protection
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// un poco de limpieza previa
|
|
|
|
|
// este es el temporal
|
|
|
|
|
$glob = glob($path . $prodID. '_tmp');
|
|
|
|
|
limpia($glob);
|
|
|
|
|
|
|
|
|
|
limpia($path . '_' . $size1_w . '.jpg');
|
|
|
|
|
limpia($path . '_' . $size2_w . '.jpg');
|
|
|
|
|
// fin de la limpia
|
|
|
|
|
|
|
|
|
|
if(strlen($_FILES['prod_imagen']['name'])) {
|
|
|
|
|
$my_uploader = new uploader('es'); // Create a new instance of the class
|
|
|
|
|
$my_uploader->max_filesize(150000); // OPTIONAL: set the max filesize of uploadable files in bytes
|
2011-05-30 17:04:37 +00:00
|
|
|
$my_uploader->max_image_size(1600, 1600); // OPTIONAL: if you're uploading images, you can set the max pixel dimensions
|
|
|
|
|
// UPLOAD the file
|
|
|
|
|
if ($my_uploader->upload($upload_file_name, $acceptable_file_types, $default_extension)) {
|
|
|
|
|
$my_uploader->save_file($path, $prodID . '_tmp', $mode);
|
|
|
|
|
if (!$my_uploader->error) {
|
|
|
|
|
$my_uploader->resize($prodID . '_' . $size1_w . '.jpg', $size1_w, $size1_h, 60);
|
|
|
|
|
if($size2_w) {
|
|
|
|
|
$my_uploader->resize($prodID . '_' . $size2_w . '.jpg', $size2_w, $size2_h, 60);
|
|
|
|
|
}
|
|
|
|
|
$my_uploader->delete_file;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ($my_uploader->error) {
|
|
|
|
|
echo $my_uploader->error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$glob = glob($path . $proid. '_tmp');
|
|
|
|
|
limpia($glob);
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
function uploadImagenOferta($prodID, $size1_w, $size1_h, $size2_w=0, $size2_h=0, $mascara='') {
|
|
|
|
|
$path = "../../_ofr/"; // este directorio tiene que tener chmod 777
|
|
|
|
|
$upload_file_name = "ofr_imagen"; // el nombre del campo tipo file de nuestro formulario
|
|
|
|
|
$acceptable_file_types = "image/gif|image/jpeg|image/pjpeg"; // acepta GIF et JPEG
|
|
|
|
|
$default_extension = "";
|
|
|
|
|
$mode = 1; // OPTIONS:
|
|
|
|
|
// 1 = overwrite mode
|
|
|
|
|
// 2 = create new with incremental extention
|
|
|
|
|
// 3 = do nothing if exists, highest protection
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// un poco de limpieza previa
|
|
|
|
|
// este es el temporal
|
|
|
|
|
$glob = glob($path . $prodID. '_tmp');
|
|
|
|
|
limpia($glob);
|
|
|
|
|
|
|
|
|
|
limpia($path . '_' . $size1_w . '.jpg');
|
|
|
|
|
limpia($path . '_' . $size2_w . '.jpg');
|
|
|
|
|
// fin de la limpia
|
|
|
|
|
|
|
|
|
|
if(strlen($_FILES['ofr_imagen']['name'])) {
|
|
|
|
|
$my_uploader = new uploader('es'); // Create a new instance of the class
|
|
|
|
|
$my_uploader->max_filesize(150000); // OPTIONAL: set the max filesize of uploadable files in bytes
|
2011-05-09 15:07:48 +00:00
|
|
|
$my_uploader->max_image_size(1600, 1600); // OPTIONAL: if you're uploading images, you can set the max pixel dimensions
|
|
|
|
|
// UPLOAD the file
|
|
|
|
|
if ($my_uploader->upload($upload_file_name, $acceptable_file_types, $default_extension)) {
|
|
|
|
|
$my_uploader->save_file($path, $prodID . '_tmp', $mode);
|
|
|
|
|
if (!$my_uploader->error) {
|
|
|
|
|
$my_uploader->resize($prodID . '_' . $size1_w . '.jpg', $size1_w, $size1_h, 60);
|
|
|
|
|
if($size2_w) {
|
|
|
|
|
$my_uploader->resize($prodID . '_' . $size2_w . '.jpg', $size2_w, $size2_h, 60);
|
|
|
|
|
}
|
|
|
|
|
$my_uploader->delete_file;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ($my_uploader->error) {
|
|
|
|
|
echo $my_uploader->error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$glob = glob($path . $proid. '_tmp');
|
|
|
|
|
limpia($glob);
|
|
|
|
|
}
|
|
|
|
|
}
|
2011-05-06 11:33:27 +00:00
|
|
|
|
|
|
|
|
function uploadImagenMarca($prodID, $size_w, $size_h, $mascara='') {
|
|
|
|
|
$path = "../../_logos/c/"; // este directorio tiene que tener chmod 777
|
|
|
|
|
$upload_file_name = "marca_imagen"; // el nombre del campo tipo file de nuestro formulario
|
|
|
|
|
$acceptable_file_types = "image/gif"; // acepta GIF et JPEG
|
|
|
|
|
$default_extension = "";
|
|
|
|
|
$mode = 1; // OPTIONS:
|
|
|
|
|
// 1 = overwrite mode
|
|
|
|
|
// 2 = create new with incremental extention
|
|
|
|
|
// 3 = do nothing if exists, highest protection
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
if(strlen($_FILES[$upload_file_name]['name'])) {
|
|
|
|
|
$my_uploader = new uploader('es'); // Create a new instance of the class
|
|
|
|
|
$my_uploader->max_filesize(150000); // OPTIONAL: set the max filesize of uploadable files in bytes
|
|
|
|
|
$my_uploader->max_image_size(1600, 1600); // OPTIONAL: if you're uploading images, you can set the max pixel dimensions
|
|
|
|
|
// UPLOAD the file
|
|
|
|
|
if ($my_uploader->upload($upload_file_name, $acceptable_file_types, $default_extension)) {
|
|
|
|
|
$my_uploader->save_file($path, $prodID . '.gif', $mode);
|
|
|
|
|
} else {
|
|
|
|
|
echo $my_uploader->error;
|
|
|
|
|
}
|
|
|
|
|
if ($my_uploader->error) {
|
|
|
|
|
echo $my_uploader->error;
|
|
|
|
|
}
|
|
|
|
|
} else {
|
|
|
|
|
echo 'no file';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
2011-06-15 08:43:54 +00:00
|
|
|
function uploadPDFOferta($prodID) {
|
|
|
|
|
$path = "../../_ofr/"; // este directorio tiene que tener chmod 777
|
|
|
|
|
$upload_file_name = "ofr_pdf"; // el nombre del campo tipo file de nuestro formulario
|
|
|
|
|
$acceptable_file_types = ""; // acepta GIF et JPEG
|
|
|
|
|
$default_extension = "";
|
|
|
|
|
$mode = 1; // OPTIONS:
|
|
|
|
|
// 1 = overwrite mode
|
|
|
|
|
// 2 = create new with incremental extention
|
|
|
|
|
// 3 = do nothing if exists, highest protection
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
// un poco de limpieza previa
|
|
|
|
|
// este es el temporal
|
|
|
|
|
$glob = glob($path . $prodID. '_tmp');
|
|
|
|
|
limpia($glob);
|
|
|
|
|
limpia($path . '_' . $prodID . '.pdf');
|
|
|
|
|
// fin de la limpia
|
|
|
|
|
|
|
|
|
|
if(strlen($_FILES['ofr_pdf']['name'])) {
|
|
|
|
|
$my_uploader = new uploader('es'); // Create a new instance of the class
|
|
|
|
|
$my_uploader->max_filesize(5000000); // OPTIONAL: set the max filesize of uploadable files in bytes
|
|
|
|
|
// $my_uploader->max_image_size(1600, 1600); // OPTIONAL: if you're uploading images, you can set the max pixel dimensions
|
|
|
|
|
// UPLOAD the file
|
|
|
|
|
if ($my_uploader->upload($upload_file_name, $acceptable_file_types, $default_extension)) {
|
|
|
|
|
$my_uploader->save_file($path, $prodID . '.pdf', $mode);
|
|
|
|
|
if (!$my_uploader->error) {
|
|
|
|
|
$my_uploader->delete_file;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
if ($my_uploader->error) {
|
|
|
|
|
echo $my_uploader->error;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
$glob = glob($path . $proid. '_tmp');
|
|
|
|
|
limpia($glob);
|
|
|
|
|
}
|
|
|
|
|
// else
|
|
|
|
|
// limpia($path . $prodID . '.pdf');
|
|
|
|
|
}
|
|
|
|
|
|
2011-05-06 11:33:27 +00:00
|
|
|
?>
|