本文整理汇总了PHP中form::upload方法的典型用法代码示例。如果您正苦于以下问题:PHP form::upload方法的具体用法?PHP form::upload怎么用?PHP form::upload使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类form
的用法示例。
在下文中一共展示了form::upload方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: foreach
?>
<a href="#" class="add" onClick="addFormField('divPhoto', 'incident_photo','photo_id','file'); return false;">add</a>
</div>
<?php
} else {
?>
<?php
foreach ($form[$this_field]['name'] as $value) {
?>
<div class="report_row" id="<?php
echo $i;
?>
">
<?php
print form::upload('incident_photo[]', $value, ' class="file long2"');
?>
<a href="#" class="add" onClick="addFormField('divPhoto','incident_photo','photo_id','file'); return false;">add</a>
<?php
if ($i != 0) {
?>
<?php
$css_id = "#incident_photo_" . $i;
?>
<a href="#" class="rem" onClick="removeFormField('<?php
echo $css_id;
?>
'); return false;">remove</a>
<?php
}
示例2: File
?>
<?php
if (!strcasecmp(Router::$method, 'create')) {
?>
<?php
echo form::open_section('File');
?>
<div class="field">
<?php
echo form::label('mediafile[upload]', 'Audio File (MP3 or WAV):');
?>
<?php
echo form::upload('mediafile[upload]');
?>
</div>
<div class="field">
The file size is limited to <?php
echo ini_get('upload_max_filesize');
?>
, if you want to change this value follow this
<?php
echo html::anchor('http://wiki.2600hz.org/display/bluebox/Modifying+the+max+file+size', 'link');
?>
.
</div>
<?php
示例3: bannerForm
function bannerForm($name, $path, $config)
{
if (isset($config["specials.{$name}"]) && file_exists(APPPATH . '../../..' . $path . $config["specials.{$name}"])) {
echo html::image('..' . $path . $config["specials.{$name}"]) . '<br/>';
}
$attributes = array('name' => $name, 'class' => 'banner_upload');
echo form::upload($attributes, $path);
}
示例4: render
public function render(&$render_variables, $errors = array())
{
// Load base template and attributes
$result = parent::render($render_variables, $errors);
// Discover the type
switch ($this->type) {
case 'input':
$result['template']->element = form::input($result['attributes'], $this->value);
break;
case 'password':
$result['template']->element = form::password($result['attributes'], $this->value);
break;
case 'submit':
$result['template']->element = form::submit($result['attributes'], $this->value);
$render_variables['submit'] = TRUE;
break;
case 'radio':
$result['template']->element = form::radio($result['attributes'], $this->value);
break;
case 'checkbox':
$result['attributes']['value'] = $this->value;
if ($this->value = Input::instance()->post($this->name)) {
$result['template']->element = form::checkbox($result['attributes'], $this->value, TRUE);
} else {
$result['template']->element = form::checkbox($result['attributes'], $this->value);
}
break;
case 'hidden':
$result['template']->element = form::hidden($this->name, $this->value);
break;
case 'file':
$result['template']->element = form::upload($result['attributes'], $this->value);
$render_variables['enctype'] = 'multipart/form-data';
break;
}
// Return the resulting output
return (string) $result['template']->render();
}
示例5:
<h2><?php
echo $action;
?>
Photo</h2>
<?php
echo $errors;
echo form::open_multipart();
?>
<ul>
<li><label for="photo_name">Photo Name: </label><?php
echo form::input('photo_name', $photo->photo_name);
?>
</li>
<li><label for="photo">File: </label><?php
echo form::upload('photo');
?>
</li>
<li><?php
echo form::submit('create', $action . ' Photo');
?>
</li>
</ul>
<?php
echo form::close();
示例6:
<strong><?php
echo Kohana::lang('ui_main.description');
?>
:</strong><br />
<?php
print form::input('description', $form['description'], ' class="text"');
?>
</div>
<div class="tab_form_item">
<strong><?php
echo Kohana::lang('ui_main.badge_image');
?>
:</strong><br />
<?php
echo form::upload('image', '', '');
?>
</div>
<div style="clear:both"></div>
<div class="tab_form_item">
<br />
<input type="image" src="<?php
echo url::file_loc('img');
?>
media/img/admin/btn-save.gif" class="save-rep-btn" />
</div>
<?php
print form::close();
?>
</div>
示例7: array
for(var i=0; i<elements.length; i++) {
if(elements[i].type=='checkbox' && elements[i].name=='active_overlays[]') {
elements[i].checked = false;
}
}
}
}
</script>
<hr>
<div>
<h2>Upload New Overlay</h2>
<?php
echo form::open_multipart('admin/emboss/new_overlay');
echo access::csrf_form_field();
echo form::upload(array('name' => 'overlay', 'style' => 'margin: .5em 0 .5em 0'));
echo form::submit(array('name' => 'Upload', 'style' => 'display:block; float:none'), 'Upload');
?>
</form>
</div>
<hr>
<div>
<?php
echo form::open('admin/emboss/update', array('name' => 'options'));
echo access::csrf_form_field();
?>
<h2>Available Overlays</h2>
<table style="margin:.5em 0 .5em 0">
<tr>
<th style>Active</th>
<th>Image</th>
示例8:
<?php
echo form::upload($field->name, $field->value, $field->extra);
示例9: t
</li>
<li>
<?php
echo form::label("is_admin", t("Generate an admin theme"));
?>
<?php
echo form::checkbox("is_admin", "", !empty($form["is_admin"]));
?>
</li>
<li>
<?php
echo form::label("zip_file", t("Upload and generate theme"));
?>
<br />
<?php
echo form::upload(array("name" => "zip_file", "id" => "g-themeroller-zip", "accept" => "application/zip, multipart/x-zip"));
?>
<span style="z-index: 1">
<button type="submit"
id="g-generate-theme"
class="<?php
echo $submit_class;
?>
"
<?php
if ($not_writable) {
?>
disabled<?php
}
?>
>
示例10: html_element
protected function html_element()
{
// Create a temp copy
$data = $this->data;
// Remove Message
unset($data['message']);
return form::upload($data);
}
示例11: __toString
public function __toString()
{
return form::upload(array('name' => $this->field_name)) . form::hidden('name_img' . $this->field_name, $this->field_value) . '<br/>' . $this->field_value;
}
示例12: rows
public static function rows($item)
{
// print Kohana::debug($item);
$output = '';
foreach ($item->as_array() as $column_name => $column_value) {
if ($column_name === 'id') {
continue;
}
$output .= '<li class="row">';
$output .= form::label($column_name, self::label($item, $column_name));
if (empty($item->table_columns[$column_name]['null'])) {
$required = 'required';
} else {
$required = NULL;
}
// print_r($item->table_columns[$column_name]);
switch ($item->table_columns[$column_name]['type']) {
case 'boolean':
if ($column_value) {
$checked = TRUE;
} else {
$checked = FALSE;
}
$output .= form::checkbox($column_name, $column_value, $checked, 'class="checkbox ' . $required . '"');
break;
case 'string':
if (empty($item->table_columns[$column_name]['length'])) {
if (empty($item->table_columns[$column_name]['format'])) {
$output .= form::textarea($column_name, $column_value);
} else {
$output .= form::input($column_name, $column_value, 'class="date ' . $required . '"');
}
} else {
if (array_key_exists('binary', $item->table_columns[$column_name])) {
if ($column_value) {
$checked = TRUE;
} else {
$checked = FALSE;
}
$output .= form::checkbox($column_name, $column_value, $checked, 'class="checkbox ' . $required . '"');
} else {
if (property_exists($item, 'admin') && array_key_exists($column_name, $item->admin) && $item->admin[$column_name]['type'] === 'file') {
$attributes = array('name' => $column_name);
$output .= form::upload($attributes, $column_value);
$file_name = basename($column_value);
$upload_to = '/';
if (array_key_exists('upload_to', $item->admin[$column_name])) {
$upload_to = '/' . $item->admin[$column_name]['upload_to'] . '/';
}
$link = '/' . Kohana::config('upload.relative_path') . $upload_to . $file_name;
$full_file_path = rtrim(DOCROOT, '/') . $column_value;
$file_type = explode('/', file::mime($full_file_path));
$file_type = $file_type[0];
// print Kohana::debug($link);
if ($file_type == 'image') {
$image_source = $link;
$file_data = pathinfo($full_file_path);
$thumb = $file_data['dirname'] . '/' . $file_data['filename'] . '_small.' . $file_data['extension'];
if (file_exists($thumb)) {
$image_source = '/' . Kohana::config('upload.relative_path') . $upload_to . $file_data['filename'] . '_small.' . $file_data['extension'];
}
$output .= '<div class="picture-container">' . html::anchor($link, html::image(array('src' => $image_source, 'width' => 100)), array('target' => '_blank')) . '</div>';
} else {
$output .= html::anchor($link, $file_name, array('target' => '_blank'));
}
} else {
$output .= form::input($column_name, $column_value, 'class="' . $required . '" size="' . $item->table_columns[$column_name]['length'] . '" maxlength="' . $item->table_columns[$column_name]['length'] . '"');
$output .= '<div class="hint">Maximum length is ' . $item->table_columns[$column_name]['length'] . '.</div>';
}
}
}
break;
case 'int':
if (array_key_exists('max', $item->table_columns[$column_name]) and $item->table_columns[$column_name]['max'] == 127) {
if ($column_value) {
$checked = TRUE;
} else {
$checked = FALSE;
}
$output .= form::checkbox($column_name, $column_value, $checked, 'class="checkbox ' . $required . '"');
break;
}
$belongs_to = FALSE;
$model_name = '';
$selection = array();
foreach (array_values($item->belongs_to) as $model_name) {
if ($model_name . '_id' == $column_name) {
$belongs_to = TRUE;
}
}
if ($belongs_to) {
preg_match('/(\\w+)_id/', $column_name, $matcher);
$model_name = $matcher[1];
$selection = array();
$current_model = ORM::factory($model_name);
$objects = $current_model->find_all();
foreach ($objects as $object) {
$selection[$object->id] = (string) $object;
}
// Check if we have has_one relation
//.........这里部分代码省略.........
示例13: array
<h2>Set highlighted location</h2>
<!-- tab -->
<div class="tab">
<?php
print form::open(NULL, array('enctype' => 'multipart/form-data', 'id' => 'layerMain', 'name' => 'layerMain'));
?>
<div class="tab_form_item">
Upload KML File:
<?php
print form::upload('file', '', '');
?>
</div>
<div style="clear:both"></div>
<div class="tab_form_item">
This layer will be shown on the map on "Submit a report" page<br /><br/>
<input type="image" src="<?php
echo url::base();
?>
media/img/admin/btn-save.gif" class="save-rep-btn" />
</div>
<?php
print form::close();
?>
</div>
示例14:
if ($logo_file) {
print "<div class=\"report_thumbs\" id=\"photo_1\">";
$thumb = $logo_file . "_t.jpg";
$logo_link = $logo_file . ".jpg";
$prefix = url::base() . Kohana::config('upload.relative_directory') . "/groups";
print "<a class='photothumb' rel='lightbox-group1' href='{$prefix}/{$logo_link}'>";
print "<img src=\"{$prefix}/{$thumb}\" >";
print "</a>";
print "</div>";
}
?>
</div>
<div id="divPhoto">
<?php
print "<div class=\"row link-row\">";
print form::upload('logo');
print "</div>";
?>
</div>
</div>
<div class="row">
<h4><?php
echo Kohana::lang('simplegroups.users');
?>
</h4>
<table class="table">
<thead>
<tr><th><?php
echo Kohana::lang('simplegroups.use');
?>
示例15: upload_wrap
/**
* Creates an HTML form upload input tag.
*
* @param string|array input name or an array of HTML attributes
* @param string|array input value, when using a name or values
* @param string a string to be attached to the end of the attributes
* @param string $label
* @param string|array $error
* @param string|array $tip
* @return string
*/
public static function upload_wrap($data, $value = '', $extra = '', $label = '', $error = '', $tip = '')
{
$name = is_array($data) ? arr::get($data, 'name') : $data;
$value = is_array($value) ? arr::get($value, $name) : $value;
// Add id to input if label given
if ($label) {
if (!is_array($data)) {
$data = array('name' => $name, 'id' => $name);
} else {
if (!isset($data['id'])) {
$data['id'] = $name;
}
}
}
$input = form::upload($data, $value, $extra);
return form::wrap($input, $name, $label, $error, $tip);
}