if ($is_upload && $field['is_blob']) { echo '<br />'; echo '<input type="file" name="fields_upload' . $vkey . '[' . $field['Field_md5'] . ']" class="textfield" id="field_' . $idindex . '_3" size="10" ' . $unnullify_trigger . '/> '; // find maximum upload size, based on field type /** * @todo with functions this is not so easy, as you can basically * process any data with function like MD5 */ $max_field_sizes = array('tinyblob' => '256', 'blob' => '65536', 'mediumblob' => '16777216', 'longblob' => '4294967296'); // yeah, really $this_field_max_size = $max_upload_size; // from PHP max if ($this_field_max_size > $max_field_sizes[$field['pma_type']]) { $this_field_max_size = $max_field_sizes[$field['pma_type']]; } echo PMA_getFormattedMaximumUploadSize($this_field_max_size) . "\n"; // do not generate here the MAX_FILE_SIZE, because we should // put only one in the form to accommodate the biggest field if ($this_field_max_size > $biggest_max_file_size) { $biggest_max_file_size = $this_field_max_size; } } if (!empty($cfg['UploadDir'])) { $files = PMA_getFileSelectOptions(PMA_userDir($cfg['UploadDir'])); if ($files === false) { echo ' <font color="red">' . __('Error') . '</font><br />' . "\n"; echo ' ' . __('The directory you set for upload work cannot be reached') . "\n"; } elseif (!empty($files)) { echo "<br />\n"; echo ' <i>' . __('Or') . '</i>' . ' ' . __('web server upload directory') . ':<br />' . "\n"; echo ' <select size="1" name="fields_uploadlocal' . $vkey . '[' . $field['Field_md5'] . ']">' . "\n";
/** * @dataProvider dataProvider * @return void */ function testMaximumUploadSize($size, $unit, $res) { $this->assertEquals("(" . __('Max: ') . $res . $unit . ")", PMA_getFormattedMaximumUploadSize($size)); }
/** * Display the form used to browse anywhere on the local server for a file to * import * * @param string $max_upload_size maximum upload size * * @return void */ function PMA_browseUploadFile($max_upload_size) { if ($GLOBALS['is_upload'] && !empty($GLOBALS['cfg']['UploadDir'])) { echo '<label for="radio_import_file">'; } else { echo '<label for="input_import_file">'; } echo __("Browse your computer:") . '</label>'; echo '<div id="upload_form_status" style="display: none;"></div>'; echo '<div id="upload_form_status_info" style="display: none;"></div>'; echo '<input type="file" name="import_file" id="input_import_file" />'; echo PMA_getFormattedMaximumUploadSize($max_upload_size) . "\n"; // some browsers should respect this :) echo PMA_generateHiddenMaxFileSize($max_upload_size) . "\n"; }
/** * prints bookmark fieldset * * @usedby PMA_sqlQueryForm() */ function PMA_sqlQueryFormUpload() { $errors = array(); $matcher = '@\\.sql(\\.(' . PMA_supportedDecompressions() . '))?$@'; // we allow only SQL here if (!empty($GLOBALS['cfg']['UploadDir'])) { $files = PMA_getFileSelectOptions(PMA_userDir($GLOBALS['cfg']['UploadDir']), $matcher, isset($timeout_passed) && $timeout_passed && isset($local_import_file) ? $local_import_file : ''); } else { $files = ''; } // start output echo '<fieldset id="">'; echo '<legend>'; echo __('Browse your computer:') . '</legend>'; echo '<div class="formelement">'; echo '<input type="file" name="sql_file" class="textfield" /> '; echo PMA_getFormattedMaximumUploadSize($GLOBALS['max_upload_size']); // some browsers should respect this :) echo PMA_generateHiddenMaxFileSize($GLOBALS['max_upload_size']) . "\n"; echo '</div>'; if ($files === false) { $errors[] = PMA_Message::error(__('The directory you set for upload work cannot be reached')); } elseif (!empty($files)) { echo '<div class="formelement">'; echo '<strong>' . __('web server upload directory') . ':</strong>' . "\n"; echo '<select size="1" name="sql_localfile">' . "\n"; echo '<option value="" selected="selected"></option>' . "\n"; echo $files; echo '</select>' . "\n"; echo '</div>'; } echo '<div class="clearfloat"></div>' . "\n"; echo '</fieldset>'; echo '<fieldset id="" class="tblFooters">'; echo __('Character set of the file:') . "\n"; echo PMA_generateCharsetDropdownBox(PMA_CSDROPDOWN_CHARSET, 'charset_of_file', null, 'utf8', false); echo '<input type="submit" name="SQL" value="' . __('Go') . '" />' . "\n"; echo '<div class="clearfloat"></div>' . "\n"; echo '</fieldset>'; foreach ($errors as $error) { $error->display(); } }