Пример #1
0
<?php

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 {