Esempio n. 1
0
include_once getcwd() . "/classes/BLCarPicture.php";
include_once getcwd() . "/classes/BLCarFile.php";
include_once getcwd() . "/classes/BLBlobs.php";
$blCarPicture = new BLCarPicture();
$blCarFile = new BLCarFile();
$blBlobs = new BLBlobs();
$files = $blCarFile->getCarFiles();
$pictures = $blCarPicture->getCarPictures();
echo '<h1>Files</h1>';
foreach ($files as $file) {
    if ($file->getBlobId() == null) {
        //Import file
        try {
            echo "Start: " . $file->getName() . "<br />";
            $path = getcwd() . "/files/" . $file->getName() . "." . $file->getType();
            $blobId = $blBlobs->uploadBlobs($path);
            $file->setBlobId($blobId);
            $blCarFile->updateCarFile($file);
            echo "End: " . $file->getName() . " uploaded!<br /><hr />";
        } catch (Exception $ex) {
            echo $ex;
        }
    }
}
echo '<h1>Pictures</h1>';
foreach ($pictures as $picture) {
    if ($picture->getBlobId() == null) {
        //Import picture
        try {
            echo "Start: " . $picture->getName() . "<br />";
            $path = getcwd() . "/pictures/" . $picture->getName() . "." . $picture->getType();
Esempio n. 2
0
if (isset($_POST['filenr'])) {
    $nr = $_POST["filenr"];
    $i = 0;
    for ($i = 1; $i < $nr; $i++) {
        //file uploaden + naar tabel wegschrijven
        if (trim($_POST["filetext" . $i]) != "") {
            if (!empty($_FILES['file' . $i])) {
                $file = $_POST["carid"] . "_" . strtolower(str_replace(" ", "_", $_FILES['file' . $i]['name']));
                $target_path = getcwd() . "/files/";
                //upload
                $target_path = $target_path . $file;
                chmod($target_path, 0777);
                if (move_uploaded_file($_FILES['file' . $i]['tmp_name'], $target_path)) {
                    $errorfiles .= '<span style="color:green">The file ' . $file . ' has been uploaded.<br />';
                    //Insert blob in table
                    $blobId = $blBlobs->uploadBlobs($target_path . $file);
                    $carfile = new CarFile(0, str_replace("." . findexts($file), "", $file), findexts($file), $_POST["filetext" . $i], $_POST["carid"], $blobId);
                    $blCarFile->insertCarFile($carfile);
                } else {
                    $errorfiles .= "There was an error uploading the file, please try again! (" . $file . ")<br />";
                }
            }
        } else {
            $errorfiles .= "Text is a required field! (" . $_FILES['file' . $i]['name'] . ")<br />";
        }
    }
}
?>
 			

<script language="javascript" type="text/javascript">
Esempio n. 3
0
$blPictureOrder = new BLPictureOrder();
$blBlobs = new BLBlobs();
include_once getcwd() . "/include/imagehandler.php";
$upload_name = "Filedata";
//image uploaden + naar tabel wegschrijven
if (!empty($_FILES[$upload_name])) {
    if (findexts($_FILES[$upload_name]['name']) == "jpg" || findexts($_FILES[$upload_name]['name']) == "jpeg" || findexts($_FILES[$upload_name]['imagename']) == "gif" || findexts($_FILES[$upload_name]['name']) == "png") {
        $file = $_POST["CARID"] . "_" . strtolower(str_replace(" ", "_", $_FILES[$upload_name]['name']));
        $path = getcwd() . "/pictures/";
        //large
        $errorim = upload($_FILES[$upload_name]['tmp_name'], $path, $file, 1600, 1600);
        chmod($path . $file, 0777);
        //class
        if ($errorim[0] == true) {
            //Insert blob in table
            $blobId = $blBlobs->uploadBlobs($path . $file);
            $carpicture = new CarPicture(0, str_replace("." . findexts($file), "", $file), findexts($file), $_POST["CARID"], $blobId);
            $carpicture->setId($blCarPicture->insertCarPicture($carpicture));
            $car = $blCar->getCar($_POST["CARID"]);
            //default
            if ($car->getDefaultPictureId() == null) {
                $car->setDefaultPictureId($carpicture->getId());
                $blCar->updateCar($car);
            }
            //pictureorder
            $max = $blPictureOrder->getMaxPictureOrderByCar($car->getId()) + 1;
            $pictureorder = new PictureOrder(0, $max, $car->getId(), $carpicture->getId());
            $blPictureOrder->insertPictureOrder($pictureorder);
            //success
            //HandleError('<span style="color:green">' . $file . ' saved!</span><br />');
            $carpicturelist[] = $carpicture;