本文整理汇总了PHP中Upload::getUploadError方法的典型用法代码示例。如果您正苦于以下问题:PHP Upload::getUploadError方法的具体用法?PHP Upload::getUploadError怎么用?PHP Upload::getUploadError使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Upload
的用法示例。
在下文中一共展示了Upload::getUploadError方法的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();
}
}
示例2: 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();
}
}
示例3: 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"));
}
}
示例4: __createErrors
function __createErrors()
{
if (Upload::isUploadSuccessful("my_file")) {
return null;
} else {
return Upload::getUploadError("my_file");
}
}
示例5: 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();
}
}
示例6: 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();
}
}