当前位置: 首页>>代码示例>>PHP>>正文


PHP Upload::isUploadSuccessful方法代码示例

本文整理汇总了PHP中Upload::isUploadSuccessful方法的典型用法代码示例。如果您正苦于以下问题:PHP Upload::isUploadSuccessful方法的具体用法?PHP Upload::isUploadSuccessful怎么用?PHP Upload::isUploadSuccessful使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Upload的用法示例。


在下文中一共展示了Upload::isUploadSuccessful方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: add_to_gallery

 function add_to_gallery()
 {
     $gallery_peer = new GalleryPeer();
     $gallery = $gallery_peer->find_by_id(Params::get("id_gallery"));
     $collection_peer = new GalleryCollectionPeer();
     $gallery_collection = $collection_peer->find_by_id($gallery->id_gallery_collection);
     $full_folder_path = GalleryCollectionController::GALLERY_COLLECTION_ROOT_DIR . $gallery_collection->folder . "/" . $gallery->folder;
     if (Upload::isUploadSuccessful("file")) {
         $filename = Random::newHexString() . "_" . Upload::getRealFilename("file");
         $gallery_dir = new Dir($full_folder_path);
         $uploaded_img = Upload::saveTo("file", $gallery_dir, $filename);
         if (isset(Config::instance()->GALLERY_RESIZE_BY_WIDTH)) {
             image_w($uploaded_img->getPath(), Config::instance()->GALLERY_RESIZE_BY_WIDTH);
         } else {
             if (isset(Config::instance()->GALLERY_RESIZE_BY_HEIGHT)) {
                 image_h($uploaded_img->getPath(), Config::instance()->GALLERY_RESIZE_BY_HEIGHT);
             }
         }
         $peer = new GalleryImagePeer();
         $do = $peer->new_do();
         $peer->setupByParams($do);
         $do->image_name = $filename;
         $peer->save($do);
         return Redirect::success();
     } else {
         Flash::error(Upload::getUploadError("file"));
         return Redirect::failure();
     }
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:29,代码来源:GalleryImageController.class.php

示例2: aggiungi_immagine

 function aggiungi_immagine()
 {
     $id_prodotto_servizio = Params::get("id_prodotto_servizio");
     if (Params::is_set("file_field_name")) {
         $file_field_name = Params::get("file_field_name");
     } else {
         $file_field_name = "file";
     }
     if (Upload::isUploadSuccessful($file_field_name)) {
         $product_dir = new Dir(self::PRODUCT_IMAGE_DIR . "/" . $id_prodotto_servizio);
         $product_dir->touch();
         $uploaded_img = Upload::saveTo($file_field_name, $product_dir);
         if (isset(Config::instance()->PRODUCT_IMAGE_RESIZE_BY_WIDTH)) {
             image_w($uploaded_img->getPath(), Config::instance()->PRODUCT_IMAGE_RESIZE_BY_WIDTH);
         } else {
             if (isset(Config::instance()->PRODUCT_IMAGE_RESIZE_BY_HEIGHT)) {
                 image_h($uploaded_img->getPath(), Config::instance()->PRODUCT_IMAGE_RESIZE_BY_HEIGHT);
             }
         }
         //creo una riga associata all'immagine
         $immagine_prodotto_servizio_peer = new ImmagineProdottoServizioPeer();
         $do = $immagine_prodotto_servizio_peer->new_do();
         $do->id_prodotto_servizio = Params::get("id_prodotto_servizio");
         $do->nome_immagine = $uploaded_img->getFilename();
         $immagine_prodotto_servizio_peer->save($do);
         return Redirect::success();
     } else {
         Flash::error(Upload::getUploadError($file_field_name));
         return Redirect::failure();
     }
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:31,代码来源:ProdottoServizioController.class.php

示例3: add

 function add()
 {
     if (Upload::isUploadSuccessful("my_file")) {
         $peer = new ImmaginiPeer();
         $do = $peer->new_do();
         $peer->setupByParams($do);
         $d = new Dir("/immagini/user/" . Session::get("/session/username") . Params::get("folder"));
         if (!$d->exists()) {
             $d->touch();
         }
         $do->save_folder = $d->getPath();
         $do->real_name = Upload::getRealFilename("my_file");
         $do->folder = Params::get("folder");
         $tokens = explode(".", Upload::getRealFilename("my_file"));
         $extension = $tokens[count($tokens) - 1];
         $do->hash_name = md5(uniqid()) . "." . strtolower($extension);
         Upload::saveTo("my_file", $do->save_folder, $do->hash_name);
         $peer->save($do);
         if (is_html()) {
             Flash::ok("Immagine aggiunta con successo.");
             return Redirect::success();
         } else {
             return ActiveRecordUtils::toArray($do);
         }
     } else {
         Flash::error(Upload::getUploadError("my_file"));
         return Redirect::failure();
     }
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:29,代码来源:ImmaginiController.class.php

示例4: add

 function add()
 {
     ini_set('upload_max_filesize', 8388608 * 4);
     if (Upload::isUploadSuccessful("my_file")) {
         $peer = new DocumentiPeer();
         $do = $peer->new_do();
         $peer->setupByParams($do);
         $d = new Dir("/documenti/user/" . Session::get("/session/username") . "/contenuti/");
         if (!$d->exists()) {
             $d->touch();
         }
         $do->save_folder = $d->getPath();
         $do->real_name = Upload::getRealFilename("my_file");
         $do->folder = Params::get("folder");
         $tokens = explode(".", Upload::getRealFilename("my_file"));
         $extension = $tokens[count($tokens) - 1];
         $do->hash_name = md5(uniqid()) . "." . strtolower($extension);
         Upload::saveTo("my_file", $do->save_folder, $do->hash_name);
         $peer->save($do);
         Flash::ok("Documento aggiunto con successo.");
         return Redirect::success();
     } else {
         return Redirect::failure(Upload::getUploadError("my_file"));
     }
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:25,代码来源:DocumentiController.class.php

示例5: __createErrors

 function __createErrors()
 {
     if (Upload::isUploadSuccessful("my_file")) {
         return null;
     } else {
         return Upload::getUploadError("my_file");
     }
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:8,代码来源:DocumentiController.class.php

示例6: add_image

 function add_image()
 {
     if (Upload::isUploadSuccessful("file")) {
         $gallery_dir = new Dir($this->get_current_folder());
         $uploaded_img = Upload::saveTo("file", $gallery_dir);
         if (isset(Config::instance()->GALLERY_RESIZE_BY_WIDTH)) {
             image_w($uploaded_img->getPath(), Config::instance()->GALLERY_RESIZE_BY_WIDTH);
         } else {
             if (isset(Config::instance()->GALLERY_RESIZE_BY_HEIGHT)) {
                 image_h($uploaded_img->getPath(), Config::instance()->GALLERY_RESIZE_BY_HEIGHT);
             }
         }
         $peer = new GalleryImagePeer();
         return Redirect::success();
     } else {
         Flash::error(Upload::getUploadError("file"));
         return Redirect::failure();
     }
 }
开发者ID:mbcraft,项目名称:frozen,代码行数:19,代码来源:GalleryController.class.php


注:本文中的Upload::isUploadSuccessful方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。