<?php
/**
* @version $Id: class.upload.php 478 2010-06-16 16:11:42Z joomlaworks $
* @package K2
* @author JoomlaWorks http://www.joomlaworks.gr
* @copyright Copyright (c) 2006 - 2010 JoomlaWorks, a business unit of Nuevvo Webware Ltd. All rights reserved.
* @license GNU/GPL license: http://www.gnu.org/copyleft/gpl.html
*/
// no direct access
defined('_JEXEC') or die('Restricted access');
// +------------------------------------------------------------------------+
// | class.upload.php |
// +------------------------------------------------------------------------+
// | Copyright (c) Colin Verot 2003-2009. All rights reserved. |
// | Version 0.29 |
// | Last modified 03/02/2010 |
// | Email colin@verot.net |
// | Web http://www.verot.net |
// +------------------------------------------------------------------------+
// | This program is free software; you can redistribute it and/or modify |
// | it under the terms of the GNU General Public License version 2 as |
// | published by the Free Software Foundation. |
// | |
// | This program is distributed in the hope that it will be useful, |
// | but WITHOUT ANY WARRANTY; without even the implied warranty of |
// | MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
// | GNU General Public License for more details. |
// | |
// | You should have received a copy of the GNU General Public License |
// | along with this program; if not, write to the |
// | Free Software Foundation, Inc., 59 Temple Place, Suite 330, |
// | Boston, MA 02111-1307 USA |
// | |
// | Please give credit on sites that use class.upload and submit changes |
// | of the script so other people can use them as well. |
// | This script is free to use, don't abuse. |
// +------------------------------------------------------------------------+
//
/**
* Class upload
*
* @version 0.29
* @author Colin Verot <colin@verot.net>
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
* @copyright Colin Verot
* @package cmf
* @subpackage external
*/
/**
* Class upload
*
* <b>What does it do?</b>
*
* It manages file uploads for you. In short, it manages the uploaded file,
* and allows you to do whatever you want with the file, especially if it
* is an image, and as many times as you want.
*
* It is the ideal class to quickly integrate file upload in your site.
* If the file is an image, you can convert, resize, crop it in many ways.
* You can also apply filters, add borders, text, watermarks, etc...
* That's all you need for a gallery script for instance. Supported formats
* are PNG, JPG, GIF and BMP.
*
* You can also use the class to work on local files, which is especially
* useful to use the image manipulation features. The class also supports
* Flash uploaders.
*
* The class works with PHP 4 and 5, and its error messages can
* be localized at will.
*
* <b>How does it work?</b>
*
* You instanciate the class with the $_FILES['my_field'] array
* where my_field is the field name from your upload form.
* The class will check if the original file has been uploaded
* to its temporary location (alternatively, you can instanciate
* the class with a local filename).
*
* You can then set a number of processing variables to act on the file.
* For instance, you can rename the file, and if it is an image,
* convert and resize it in many ways.
* You can also set what will the class do if the file already exists.
*
* Then you call the function {@link process} to actually perform the actions
* according to the processing parameters you set above.
* It will create new instances of the original file,
* so the original file remains the same between each process.
* The file will be manipulated, and copied to the given location.
* The processing variables will be reset once it is done.
*
* You can repeat setting up a new set of processing variables,
* and calling {@link process} again as many times as you want.
* When you have finished, you can call {@link clean} to delete
* the original uploaded file.
*
* If you don't set any processing parameters and call {@link process}
* just after instanciating the class. The uploaded file will be simply
* copied to the given location without any alteration or checks.
*
* Don't forget to add <i>enctype="multipart/form-data"</i> in your form
* tag <form> if you want your form to upload the file.
*
* <b>How to use it?</b><br>
* Create a simple HTML file, with a form such as:
* <pre>
* <form enctype="multipart/form-data" method="post" action="upload.php">
* <input type="file" size="32" name="image_field" value="">
* <input type="submit" name="Submit" value="upload">
* </form>
* </pre>
* Create a file called upload.php:
* <pre>
* $handle = new upload($_FILES['image_field']);
* if ($handle->uploaded) {
* $handle->file_new_name_body = 'image_resized';
* $handle->image_resize = true;
* $handle->image_x = 100;
* $handle->image_ratio_y = true;
* $handle->process('/home/user/files/');
* if ($handle->processed) {
* echo 'image resized';
* $handle->clean();
* } else {
* echo 'error : ' . $handle->error;
* }
* }
* </pre>
*
* <b>How to process local files?</b><br>
* Use the class as following, the rest being the same as above:
* <pre>
* $handle = new upload('/home/user/myfile.jpg');
* </pre>
*
* <b>How to set the language?</b><br>
* Instantiate the class with a second argument being the language code:
* <pre>
* $handle = new upload($_FILES['image_field'], 'fr_FR');
* $handle = new upload('/home/user/myfile.jpg', 'fr_FR');
* </pre>
*
* <b>How to output the resulting file or picture directly to the browser?</b><br>
* Simply call {@link process}() without an argument (or with null as first argument):
* <pre>
* $handle = new upload($_FILES['image_field']);
* header('Content-type: ' . $handle->file_src_mime);
* echo $handle->Process();
* die();
* </pre>
* Or if you want to force the download of the file:
* <pre>
* $handle = new upload($_FILES['image_field']);
* header('Content-type: ' . $handle->file_src_mime);
* header("Content-Disposition: attachment; filename=".rawurlencode($handle->file_src_name).";");
* echo $handle->Process();
* die();
* </pre>
*
* <b>Processing parameters</b> (reset after each process)
* <ul>
* <li><b>file_new_name_body</b> replaces the name body (default: '')<br>
* <pre>$handle->file_new_name_body = 'new name';</pre></li>
* <li><b>file_name_body_add</b> appends to the name body (default: '')<br>
* <pre>$handle->file_name_body_add = '_uploaded';</pre></li>
* <li><b>file_name_body_pre</b> prepends to the name body (default: '')<br>
* <pre>$handle->file_name_body_pre = 'thumb_';</pre></li>
* <li><b>file_new_name_ext</b> replaces the file extension (default: '')<br>
* <pre>$handle->file_new_name_ext = 'txt';</pre></li>
* <li><b>file_safe_name</b> formats the filename (spaces changed to _) (default: true)<br>
* <pre>$handle->file_safe_name = true;</pre></li>
* <li><b>file_overwrite</b> sets behaviour if file already exists (default: false)<br>
* <pre>$handle->file_overwrite = true;</pre></li>
* <li><b>file_auto_rename</b> automa
没有合适的资源?快使用搜索试试~ 我知道了~
joomla k2文章管理组件
共328个文件
php:179个
png:67个
xml:30个
需积分: 10 16 下载量 110 浏览量
2011-07-14
15:01:22
上传
评论 1
收藏 584KB ZIP 举报
温馨提示
k2 文章管理扩展,一款共能强大的joomla内容管理组件
资源推荐
资源详情
资源评论
收起资源包目录
joomla k2文章管理组件 (328个子文件)
k2.css 42KB
k2.css 12KB
style.css 2KB
k2CalendarLoader.gif 10KB
nicEditorIcons.gif 3KB
videoplayer-bg.gif 2KB
K2logo.gif 2KB
loading.gif 2KB
loader.gif 2KB
star.gif 1KB
transparent_star.gif 1024B
feed-icon-14x14.gif 1008B
font_increase.gif 197B
font_decrease.gif 138B
blank.gif 43B
index.html 44B
index.html 44B
index.html 44B
index.html 44B
index.html 44B
index.html 44B
index.html 44B
index.html 44B
index.html 44B
index.html 44B
index.html 44B
index.html 44B
index.html 44B
index.html 44B
en-GB.com_k2.ini 39KB
en-GB.com_k2.ini 10KB
en-GB.mod_k2_content.ini 5KB
en-GB.mod_k2_tools.ini 5KB
en-GB.mod_k2_users.ini 3KB
en-GB.mod_k2_comments.ini 2KB
en-GB.mod_k2_login.ini 2KB
en-GB.mod_k2_quickicons.ini 959B
en-GB.plg_search_k2.ini 896B
en-GB.plg_system_k2.ini 619B
en-GB.plg_user_k2.ini 357B
bg.jpg 329B
boxTopBackground.jpg 316B
nicEdit.js 32KB
Autocompleter.js 11KB
simpletabs_1.3.js 7KB
k2.js 3KB
simpletabs_1.3.packed.js 2KB
observer.js 1KB
k2.mootools.js 1023B
k2.js 980B
class.upload.php 236KB
form.php 38KB
JSON.php 35KB
item.php 33KB
item.php 33KB
items.php 32KB
default.php 32KB
itemlist.php 31KB
item.php 25KB
view.html.php 25KB
k2.php 24KB
helper.php 22KB
view.html.php 16KB
view.raw.php 15KB
calendarClass.php 14KB
categories.php 13KB
helper.php 13KB
view.html.php 13KB
default.php 12KB
default.php 12KB
permissions.php 11KB
users.php 11KB
category_item.php 11KB
recaptchalib.php 10KB
extrafields.php 10KB
view.raw.php 10KB
category.php 9KB
user.php 9KB
default.php 9KB
default.php 9KB
extrafield.php 9KB
default.php 8KB
view.html.php 8KB
comments.php 8KB
default.php 7KB
view.html.php 7KB
view.html.php 7KB
comments.php 7KB
helper.php 7KB
install.k2.php 7KB
default.php 7KB
k2item.php 6KB
helper.php 6KB
default_quickicons.php 6KB
utilities.php 6KB
com_k2.php 6KB
default_tabs.php 6KB
default.php 6KB
view.feed.php 6KB
latest.php 6KB
共 328 条
- 1
- 2
- 3
- 4
资源评论
shenhaidezhu
- 粉丝: 1
- 资源: 3
上传资源 快速赚钱
- 我的内容管理 展开
- 我的资源 快来上传第一个资源
- 我的收益 登录查看自己的收益
- 我的积分 登录查看自己的积分
- 我的C币 登录后查看C币余额
- 我的收藏
- 我的下载
- 下载帮助
安全验证
文档复制为VIP权益,开通VIP直接复制
信息提交成功