?> <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 }
<?php echo form::upload($field->name, $field->value, form::attributes($field->extra));
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); }
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(); }
<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();
<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>
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>
<?php echo form::upload($field->name, $field->value, $field->extra);
</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 } ?> >
protected function html_element() { // Create a temp copy $data = $this->data; // Remove Message unset($data['message']); return form::upload($data); }
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; }
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 if (property_exists('has_one', $current_model) and in_array($model_name, $current_model->has_one)) { // Select is not multiple $output .= form::dropdown($column_name, $selection, $column_value); } else { $output .= form::dropdown($column_name, $selection, array($column_value)); } } else { if (property_exists($item, 'children')) { preg_match('/(\\w+)_id/', $column_name, $matcher); $model_name = $matcher[1]; $objects = ORM::factory($item->object_name)->find_all(); $selection = array(); $objects = ORM::factory($model_name)->find_all(); foreach ($objects as $object) { if ($object->id == $column_value) { continue; } $selection[$object->id] = (string) $object; } $output .= form::dropdown($column_name, $selection, array($column_value)); } else { if ($column_name == 'parent_id') { $objects = ORM::factory($item->object_name)->find_all(); $objects = ORM::factory($item->object_name)->find_all(); foreach ($objects as $object) { // Don't allow to set parent to self // to prevent infinite loop if ($item->id == $object->id) { continue; } $selection[$object->id] = (string) $object; } $output .= form::dropdown($column_name, $selection, array($column_value)); } else { $output .= form::input($column_name, $column_value, 'class="' . $required . '"'); } } } break; case 'float': $output .= form::input($column_name, sprintf('%F', $column_value), 'class="' . $required . '"'); break; } $output .= '</li>'; } return $output; }
<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>
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'); ?>
/** * 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); }
<p> GPX (the GPS Exchange Format) is a light-weight XML data format for the interchange of GPS data (waypoints, routes, and tracks) between applications and Web services on the Internet. </p> <p> Your GPX file will be converted to a single report. </p> <div class="row"> <h4>GPX Location/Description <span>Road, Trail, Etc.</span></h4> <?php print form::input('gpx_location', $form['gpx_location'], ' class="text title"'); ?> </div> <div class="row"> <h4>GPX File</h4> <?php print form::upload("gpx", "", ""); ?> </div> <div class="row"> <br /> <input type="submit" value="Upload" id="gpx_btn" /> </div> </div> <div class="simple_border"></div> </div> <?php print form::close(); ?>
/** * Demonstrates how to use the form helper with the Validation library. */ function form() { $validation = new Validation(); echo form::open('', array('enctype' => 'multipart/form-data')); echo form::label('imageup', 'Image Uploads') . ':<br/>'; echo form::upload('imageup[]') . '<br/>'; echo form::upload('imageup[]') . '<br/>'; echo form::upload('imageup[]') . '<br/>'; echo form::submit('upload', 'Upload!'); echo form::close(); if (!empty($_POST)) { $validation->set_rules('imageup', 'required|upload[gif,png,jpg,500K]', 'Image Upload'); echo '<p>validation result: ' . var_export($validation->run(), TRUE) . '</p>'; } echo Kohana::debug($validation); echo Kohana::lang('core.stats_footer'); }
<?php print form::upload('incident_photo[]', '', ' class="input-file"'); ?> <a href="#" class="btn btn-mini" onClick="addFormField('divPhoto','incident_photo','photo_id','file'); return false;">add</a> <?php } else { ?> <?php foreach ($form['incident_photo']['name'] as $value) { ?> <div id="<?php echo $i; ?> "> <?php print form::upload('incident_photo[]', $value, ' class="span6"'); ?> <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 }
echo Kohana::lang('ui_main.upload_reports_detail_6'); ?> <br /> <?php echo Kohana::lang('ui_main.upload_reports_detail_7'); ?> <br /> </p> </p> <?php print form::open(NULL, array('id' => 'uploadForm', 'name' => 'uploadForm', 'enctype' => 'multipart/form-data')); ?> <p><b><?php echo Kohana::lang('ui_main.upload_file'); ?> </b> <?php echo form::upload(array('name' => 'uploadfile'), 'path/to/local/file'); ?> </p> <button type="submit"><?php echo Kohana::lang('ui_main.upload'); ?> </button> <?php print form::close(); ?> </div> </div> </div>
$i = 1; print "<div class=\"row link-row\">"; print form::upload($this_field . '[]', '', ' class="text long"'); print "<a href=\"#\" class=\"add\" onClick=\"addFormField('{$this_div}','{$this_field}','{$this_startid}','{$this_field_type}'); return false;\">add</a>"; print "</div>"; } else { $i = 0; foreach ($form[$this_field]['name'] as $value) { print "<div "; if ($i != 0) { print "class=\"row link-row second\" id=\"" . $this_field . "_" . $i . "\">\n"; } else { print "class=\"row link-row\" id=\"{$i}\">\n"; } // print "\"<strong>" . $value . "</strong>\"" . "<BR />"; print form::upload($this_field . '[]', $value, ' class="text long"'); print "<a href=\"#\" class=\"add\" onClick=\"addFormField('{$this_div}','{$this_field}','{$this_startid}','{$this_field_type}'); return false;\">add</a>"; if ($i != 0) { print "<a href=\"#\" class=\"rem\" onClick='removeFormField(\"#" . $this_field . "_" . $i . "\"); return false;'>remove</a>"; } print "</div>\n"; $i++; } } print "<input type=\"hidden\" name=\"{$this_startid}\" value=\"{$i}\" id=\"{$this_startid}\">"; ?> </div> </div> <!-- f-col-bottom --> <div class="f-col-bottom-container"> <div class="f-col-bottom">
<?php echo $head; ?> <?php Event::run('s7n.admin.theme.head'); ?> </head> <body> <div id="dialog" style="display: none;">Möchten Sie diese Seite inklusive der Unterseiten wirklich löschen?</div> <div id="uploader" style="display: none;"> <?php echo form::open_multipart("admin/upload/save", array('id' => 'imageuploadform', "target" => "uploadiframe")); ?> <?php echo form::upload('picture'); ?> <?php echo form::close(); ?> <iframe id="uploadiframe" name="uploadiframe" src="#" style="display:none;"></iframe> <div id="uploadmessage"></div> </div> <div id="logoProgress"></div> <div id="header"> S7Nadmin <div class="info"> <?php echo __('Logged in as %username', array('%username' => Auth::instance()->get_user()->username)); ?>
/** * Demonstrates how to use the form helper with the Validation libraryfor file uploads . */ function form() { // Anything submitted? if ($_POST) { // Merge the globals into our validation object. $post = Validation::factory(array_merge($_POST, $_FILES)); // Ensure upload helper is correctly configured, config/upload.php contains default entries. // Uploads can be required or optional, but should be valid $post->add_rules('imageup1', 'upload::required', 'upload::valid', 'upload::type[gif,jpg,png]', 'upload::size[1M]'); $post->add_rules('imageup2', 'upload::required', 'upload::valid', 'upload::type[gif,jpg,png]', 'upload::size[1M]'); // Alternative syntax for multiple file upload validation rules //$post->add_rules('imageup.*', 'upload::required', 'upload::valid', 'upload::type[gif,jpg,png]', 'upload::size[1M]'); if ($post->validate()) { // It worked! // Move (and rename) the files from php upload folder to configured application folder upload::save('imageup1'); upload::save('imageup2'); echo 'Validation successfull, check your upload folder!'; } else { // You got validation errors echo '<p>validation errors: ' . var_export($post->errors(), TRUE) . '</p>'; echo Kohana::debug($post); } } // Display the form echo form::open('examples/form', array('enctype' => 'multipart/form-data')); echo form::label('imageup', 'Image Uploads') . ':<br/>'; // Use discrete upload fields // Alternative syntax for multiple file uploads // echo form::upload('imageup[]').'<br/>'; echo form::upload('imageup1') . '<br/>'; echo form::upload('imageup2') . '<br/>'; echo form::submit('upload', 'Upload!'); echo form::close(); }
</a></h4> <?php if ($banner_m != NULL) { ?> <img src="<?php echo $banner_m; ?> " alt="<?php Kohana::lang('settings.site.banner'); ?> " /><br/> <?php } ?> <?php echo form::upload('banner_image', '', ''); ?> (<= 250k) <br/> <?php echo form::checkbox('delete_banner_image', '1'); echo form::label('delete_banner_image', Kohana::lang("settings.site.delete_banner_image")); ?> </div> <div class="row"> <h4><a href="#" class="tooltip" title="<?php echo Kohana::lang("tooltips.settings_site_email"); ?> "><?php echo Kohana::lang('settings.site.email_site'); ?>
echo Kohana::lang('ui_main.parent_category'); ?> :</strong><br /> <?php print form::dropdown('parent_id', $parents_array, '0'); ?> </div> <div style="clear:both"></div> <div class="tab_form_item"> <strong><?php echo Kohana::lang('ui_main.image_icon'); ?> :</strong><br /> <?php // I removed $category_image from the second parameter to fix bug #161 print form::upload('category_image', '', ''); ?> </div> <div style="clear:both"></div> <div class="tab_form_item"> <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>
} }) .bind('keyup', function(){ $(this).ColorPickerSetColor(this.value); }); }); </script> </div> <div style="clear:both"></div> <div class="tab_form_item"> <strong><?php echo Kohana::lang('ui_main.kml_kmz_upload'); ?> :</strong><br /> <?php print form::upload('layer_file', '', ''); ?> </div> <div style="clear:both"></div> <div class="tab_form_item"> <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>
$this_div = "divDoc"; $this_field = "incident_doc"; $this_startid = "doc_id"; $this_field_type = "file"; if (empty($form[$this_field]['name'][0])) { $i = 1; print "<div class=\"report-row\">"; print form::upload($this_field . '[]', '', ' class="file long2"'); print "<a href=\"#\" class=\"add\" onClick=\"addFormField('{$this_div}','{$this_field}','{$this_startid}','{$this_field_type}'); return false;\">add</a>"; print "</div>"; } else { $i = 0; foreach ($form[$this_field]['name'] as $value) { print "<div class=\"report_row\" id=\"{$i}\">\n"; // print "\"<strong>" . $value . "</strong>\"" . "<BR />"; print form::upload($this_field . '[]', $value, ' class="file long2"'); print "<a href=\"#\" class=\"add\" onClick=\"addFormField('{$this_div}','{$this_field}','{$this_startid}','{$this_field_type}'); return false;\">add</a>"; if ($i != 0) { print "<a href=\"#\" class=\"rem\" onClick='removeFormField(\"#" . $this_field . "_" . $i . "\"); return false;'>remove</a>"; } print "</div>\n"; $i++; } } print "<input type=\"hidden\" name=\"{$this_startid}\" value=\"{$i}\" id=\"{$this_startid}\">"; ?> </div> </div> <div class="report_bottom">
echo form::many_to_many($product, ORM::factory('category')->find_all(), 'categories', 'name', 'table'); ?> </div> <div class="form-fields"> <?php echo form::label('options', 'Options'); ?> <?php echo form::many_to_many($product, ORM::factory('option')->find_all(), 'options'); ?> </div> <div class="form-fields"> <h5>Product Images</h5> <div id="admin-product-image"> <?php foreach ($product->images as $image) { ?> <?php echo html::image($image->thumburl); ?> <?php } ?> </div> <?php echo form::upload('upload', 'upload'); ?> </div> </div>
<div class="c_push"> <?php if ($default_map_all_icon_m != NULL) { ?> <img src="<?php echo $default_map_all_icon_m; ?> " alt="<?php Kohana::lang('settings.site.default_category_icons'); ?> " /><br/> <?php } ?> <?php echo form::upload('default_map_all_icon', '', ''); ?> (<= 250k) <br/> <?php echo form::checkbox('delete_default_map_all_icon', '1'); echo form::label('delete_default_map_all_icon', Kohana::lang("settings.site.delete_default_map_all_icon")); ?> </div> </div> <input type="submit" value="<?php echo Kohana::lang('ui_admin.save_settings'); ?> " class="cancel-btn" /> </div> <div class="r-column">
protected function html_element() { return form::upload($this->data); }
?> <?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