admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 1 | <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
Derek Allard | afd99ac | 2008-01-19 19:59:14 +0000 | [diff] [blame] | 2 | <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 3 | <head>
|
| 4 |
|
Derek Allard | 404e35d | 2007-08-07 01:00:45 +0000 | [diff] [blame] | 5 | <title>CodeIgniter User Guide : File Uploading Class</title>
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 6 |
|
| 7 | <style type='text/css' media='all'>@import url('../userguide.css');</style>
|
| 8 | <link rel='stylesheet' type='text/css' media='all' href='../userguide.css' />
|
| 9 |
|
admin | 17a890d | 2006-09-27 20:42:42 +0000 | [diff] [blame] | 10 | <script type="text/javascript" src="../nav/nav.js"></script>
|
admin | 2296fc3 | 2006-09-27 21:07:02 +0000 | [diff] [blame] | 11 | <script type="text/javascript" src="../nav/prototype.lite.js"></script>
|
admin | 17a890d | 2006-09-27 20:42:42 +0000 | [diff] [blame] | 12 | <script type="text/javascript" src="../nav/moo.fx.js"></script>
|
Derek Allard | b341237 | 2007-10-25 12:15:16 +0000 | [diff] [blame] | 13 | <script type="text/javascript" src="../nav/user_guide_menu.js"></script>
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 14 |
|
| 15 | <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
|
| 16 | <meta http-equiv='expires' content='-1' />
|
| 17 | <meta http-equiv= 'pragma' content='no-cache' />
|
| 18 | <meta name='robots' content='all' />
|
Derek Allard | 3d879d5 | 2008-01-18 19:41:32 +0000 | [diff] [blame] | 19 | <meta name='author' content='ExpressionEngine Dev Team' />
|
Derek Allard | d2df9bc | 2007-04-15 17:41:17 +0000 | [diff] [blame] | 20 | <meta name='description' content='CodeIgniter User Guide' />
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 21 |
|
| 22 | </head>
|
| 23 | <body>
|
| 24 |
|
| 25 | <!-- START NAVIGATION -->
|
| 26 | <div id="nav"><div id="nav_inner"><script type="text/javascript">create_menu('../');</script></div></div>
|
| 27 | <div id="nav2"><a name="top"></a><a href="javascript:void(0);" onclick="myHeight.toggle();"><img src="../images/nav_toggle.jpg" width="153" height="44" border="0" title="Toggle Table of Contents" alt="Toggle Table of Contents" /></a></div>
|
| 28 | <div id="masthead">
|
| 29 | <table cellpadding="0" cellspacing="0" border="0" style="width:100%">
|
| 30 | <tr>
|
Derek Allard | 39b622d | 2008-01-16 21:10:09 +0000 | [diff] [blame] | 31 | <td><h1>CodeIgniter User Guide Version 1.6.0</h1></td>
|
admin | c0d5d52 | 2006-10-30 19:40:35 +0000 | [diff] [blame] | 32 | <td id="breadcrumb_right"><a href="../toc.html">Table of Contents Page</a></td>
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 33 | </tr>
|
| 34 | </table>
|
| 35 | </div>
|
| 36 | <!-- END NAVIGATION -->
|
| 37 |
|
| 38 |
|
| 39 | <!-- START BREADCRUMB -->
|
| 40 | <table cellpadding="0" cellspacing="0" border="0" style="width:100%">
|
| 41 | <tr>
|
| 42 | <td id="breadcrumb">
|
Derek Jones | 7a9193a | 2008-01-21 18:39:20 +0000 | [diff] [blame^] | 43 | <a href="http://codeigniter.com/">CodeIgniter Home</a> ›
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 44 | <a href="../index.html">User Guide Home</a> ›
|
| 45 | File Uploading Class
|
| 46 | </td>
|
Derek Allard | bc03091 | 2007-06-24 18:25:29 +0000 | [diff] [blame] | 47 | <td id="searchbox"><form method="get" action="http://www.google.com/search"><input type="hidden" name="as_sitesearch" id="as_sitesearch" value="codeigniter.com/user_guide/" />Search User Guide <input type="text" class="input" style="width:200px;" name="q" id="q" size="31" maxlength="255" value="" /> <input type="submit" class="submit" name="sa" value="Go" /></form></td>
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 48 | </tr>
|
| 49 | </table>
|
| 50 | <!-- END BREADCRUMB -->
|
| 51 |
|
| 52 | <br clear="all" />
|
| 53 |
|
| 54 |
|
| 55 | <!-- START CONTENT -->
|
| 56 | <div id="content">
|
| 57 |
|
| 58 |
|
| 59 | <h1>File Uploading Class</h1>
|
| 60 |
|
Derek Allard | d2df9bc | 2007-04-15 17:41:17 +0000 | [diff] [blame] | 61 | <p>CodeIgniter's File Uploading Class permits files to be uploaded. You can set various
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 62 | preferences, restricting the type and size of the files.</p>
|
| 63 |
|
| 64 |
|
| 65 | <h2>The Process</h2>
|
| 66 |
|
| 67 | <p>Uploading a file involves the following general process:</p>
|
| 68 |
|
| 69 |
|
| 70 | <ul>
|
| 71 | <li>An upload form is displayed, allowing a user to select a file and upload it.</li>
|
| 72 | <li>When the form is submitted, the file is uploaded to the destination you specify.</li>
|
| 73 | <li>Along the way, the file is validated to make sure it is allowed to be uploaded based on the preferences you set.</li>
|
| 74 | <li>Once uploaded, the user will be shown a success message.</li>
|
| 75 | </ul>
|
| 76 |
|
| 77 | <p>To demonstrate this process here is brief tutorial. Afterward you'll find reference information.</p>
|
| 78 |
|
| 79 | <h2>Creating the Upload Form</h2>
|
| 80 |
|
| 81 |
|
| 82 |
|
| 83 | <p>Using a text editor, create a form called <dfn>upload_form.php</dfn>. In it, place this code and save it to your <samp>applications/views/</samp>
|
| 84 | folder:</p>
|
| 85 |
|
| 86 |
|
Derek Allard | c644128 | 2007-07-04 23:54:32 +0000 | [diff] [blame] | 87 | <textarea class="textarea" style="width:100%" cols="50" rows="23">
|
| 88 | <html>
|
| 89 | <head>
|
| 90 | <title>Upload Form</title>
|
| 91 | </head>
|
| 92 | <body>
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 93 |
|
Derek Allard | c644128 | 2007-07-04 23:54:32 +0000 | [diff] [blame] | 94 | <?=$error;?>
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 95 |
|
Derek Allard | c644128 | 2007-07-04 23:54:32 +0000 | [diff] [blame] | 96 | <?=form_open_multipart('upload/do_upload'); ?>
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 97 |
|
Derek Allard | c644128 | 2007-07-04 23:54:32 +0000 | [diff] [blame] | 98 | <input type="file" name="userfile" size="20" />
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 99 |
|
Derek Allard | c644128 | 2007-07-04 23:54:32 +0000 | [diff] [blame] | 100 | <br /><br />
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 101 |
|
Derek Allard | c644128 | 2007-07-04 23:54:32 +0000 | [diff] [blame] | 102 | <input type="submit" value="upload" />
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 103 |
|
Derek Allard | c644128 | 2007-07-04 23:54:32 +0000 | [diff] [blame] | 104 | </form>
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 105 |
|
Derek Allard | c644128 | 2007-07-04 23:54:32 +0000 | [diff] [blame] | 106 | </body>
|
| 107 | </html></textarea>
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 108 |
|
admin | e334c47 | 2006-10-21 19:44:22 +0000 | [diff] [blame] | 109 | <p>You'll notice we are using a form helper to create the opening form tag. File uploads require a multipart form, so the helper
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 110 | creates the proper syntax for you. You'll also notice we have an $error variable. This is so we can show error messages in the event
|
| 111 | the user does something wrong.</p>
|
| 112 |
|
| 113 |
|
| 114 | <h2>The Success Page</h2>
|
| 115 |
|
| 116 | <p>Using a text editor, create a form called <dfn>upload_success.php</dfn>.
|
| 117 | In it, place this code and save it to your <samp>applications/views/</samp> folder:</p>
|
| 118 |
|
Derek Allard | c644128 | 2007-07-04 23:54:32 +0000 | [diff] [blame] | 119 | <textarea class="textarea" style="width:100%" cols="50" rows="20"><html>
|
| 120 | <head>
|
| 121 | <title>Upload Form</title>
|
| 122 | </head>
|
| 123 | <body>
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 124 |
|
Derek Allard | c644128 | 2007-07-04 23:54:32 +0000 | [diff] [blame] | 125 | <h3>Your file was successfully uploaded!</h3>
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 126 |
|
Derek Allard | c644128 | 2007-07-04 23:54:32 +0000 | [diff] [blame] | 127 | <ul>
|
| 128 | <?php foreach($upload_data as $item => $value):?>
|
| 129 | <li><?=$item;?>: <?=$value;?></li>
|
| 130 | <?php endforeach; ?>
|
| 131 | </ul>
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 132 |
|
Derek Allard | c644128 | 2007-07-04 23:54:32 +0000 | [diff] [blame] | 133 | <p><?=anchor('upload', 'Upload Another File!'); ?></p>
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 134 |
|
Derek Allard | c644128 | 2007-07-04 23:54:32 +0000 | [diff] [blame] | 135 | </body>
|
| 136 | </html></textarea>
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 137 |
|
| 138 |
|
| 139 | <h2>The Controller</h2>
|
| 140 |
|
| 141 | <p>Using a text editor, create a controller called <dfn>upload.php</dfn>. In it, place this code and save it to your <samp>applications/controllers/</samp>
|
| 142 | folder:</p>
|
| 143 |
|
| 144 |
|
| 145 | <textarea class="textarea" style="width:100%" cols="50" rows="43"><?php
|
| 146 |
|
| 147 | class Upload extends Controller {
|
| 148 |
|
| 149 | function Upload()
|
| 150 | {
|
| 151 | parent::Controller();
|
| 152 | $this->load->helper(array('form', 'url'));
|
| 153 | }
|
| 154 |
|
| 155 | function index()
|
| 156 | {
|
| 157 | $this->load->view('upload_form', array('error' => ' ' ));
|
| 158 | }
|
| 159 |
|
| 160 | function do_upload()
|
| 161 | {
|
admin | e334c47 | 2006-10-21 19:44:22 +0000 | [diff] [blame] | 162 | $config['upload_path'] = './uploads/';
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 163 | $config['allowed_types'] = 'gif|jpg|png';
|
| 164 | $config['max_size'] = '100';
|
| 165 | $config['max_width'] = '1024';
|
| 166 | $config['max_height'] = '768';
|
| 167 |
|
admin | b93464d | 2006-10-31 00:36:32 +0000 | [diff] [blame] | 168 | $this->load->library('upload', $config);
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 169 |
|
| 170 | if ( ! $this->upload->do_upload())
|
| 171 | {
|
| 172 | $error = array('error' => $this->upload->display_errors());
|
| 173 |
|
| 174 | $this->load->view('upload_form', $error);
|
| 175 | }
|
| 176 | else
|
| 177 | {
|
| 178 | $data = array('upload_data' => $this->upload->data());
|
| 179 |
|
| 180 | $this->load->view('upload_success', $data);
|
| 181 | }
|
| 182 | }
|
| 183 | }
|
| 184 | ?></textarea>
|
| 185 |
|
| 186 |
|
| 187 | <h2>The Upload Folder</h2>
|
| 188 |
|
Derek Allard | d2df9bc | 2007-04-15 17:41:17 +0000 | [diff] [blame] | 189 | <p>You'll need a destination folder for your uploaded images. Create a folder at the root of your CodeIgniter installation called
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 190 | <dfn>uploads</dfn> and set its file permissions to 777.</p>
|
| 191 |
|
| 192 |
|
| 193 | <h2>Try it!</h2>
|
| 194 |
|
| 195 | <p>To try your form, visit your site using a URL similar to this one:</p>
|
| 196 |
|
| 197 | <code>www.your-site.com/index.php/<var>upload</var>/</code>
|
| 198 |
|
admin | e334c47 | 2006-10-21 19:44:22 +0000 | [diff] [blame] | 199 | <p>You should see an upload form. Try uploading an image file (either a jpg, gif, or png). If the path in your
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 200 | controller is correct it should work.</p>
|
| 201 |
|
| 202 |
|
| 203 | <p> </p>
|
| 204 |
|
| 205 | <h1>Reference Guide</h1>
|
| 206 |
|
| 207 |
|
| 208 | <h2>Initializing the Upload Class</h2>
|
| 209 |
|
Derek Allard | d2df9bc | 2007-04-15 17:41:17 +0000 | [diff] [blame] | 210 | <p>Like most other classes in CodeIgniter, the Upload class is initialized in your controller using the <dfn>$this->load->library</dfn> function:</p>
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 211 |
|
| 212 | <code>$this->load->library('upload');</code>
|
| 213 | <p>Once the Upload class is loaded, the object will be available using: <dfn>$this->upload</dfn></p>
|
| 214 |
|
| 215 |
|
| 216 | <h2>Setting Preferences</h2>
|
| 217 |
|
admin | e334c47 | 2006-10-21 19:44:22 +0000 | [diff] [blame] | 218 | <p>Similar to other libraries, you'll control what is allowed to be upload based on your preferences. In the controller you
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 219 | built above you set the following preferences:</p>
|
| 220 |
|
| 221 | <code>$config['upload_path'] = './uploads/';<br />
|
| 222 | $config['allowed_types'] = 'gif|jpg|png';<br />
|
| 223 | $config['max_size'] = '100';<br />
|
| 224 | $config['max_width'] = '1024';<br />
|
| 225 | $config['max_height'] = '768';<br />
|
| 226 | <br />
|
Rick Ellis | 325197e | 2006-11-20 17:29:05 +0000 | [diff] [blame] | 227 | $this->load->library('upload', $config);<br /><br />
|
admin | b93464d | 2006-10-31 00:36:32 +0000 | [diff] [blame] | 228 |
|
| 229 | // Alternately you can set preferences by calling the initialize function. Useful if you auto-load the class:<br />
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 230 | $this->upload->initialize($config);</code>
|
| 231 |
|
| 232 | <p>The above preferences should be fairly self-explanatory. Below is a table describing all available preferences.</p>
|
| 233 |
|
| 234 |
|
| 235 | <h2>Preferences</h2>
|
| 236 |
|
| 237 | <p>The following preferences are available. The default value indicates what will be used if you do not specify that preference.</p>
|
| 238 |
|
| 239 | <table cellpadding="0" cellspacing="1" border="0" style="width:100%" class="tableborder">
|
| 240 | <tr>
|
| 241 | <th>Preference</th>
|
| 242 | <th>Default Value</th>
|
| 243 | <th>Options</th>
|
| 244 | <th>Description</th>
|
| 245 | </tr>
|
| 246 |
|
| 247 | <tr>
|
| 248 | <td class="td"><strong>upload_path</strong></td>
|
| 249 | <td class="td">None</td>
|
| 250 | <td class="td">None</td>
|
| 251 | <td class="td">The path to the folder where the upload should be placed. The folder must be writable and the path can be absolute or relative.</td>
|
| 252 | </tr>
|
| 253 |
|
| 254 | <tr>
|
| 255 | <td class="td"><strong>allowed_types</strong></td>
|
| 256 | <td class="td">None</td>
|
| 257 | <td class="td">None</td>
|
| 258 | <td class="td">The mime types corresponding to the types of files you allow to be uploaded. Usually the file extension can be used as the mime type. Separate multiple types with a pipe.</td>
|
| 259 | </tr>
|
| 260 |
|
| 261 |
|
| 262 | <tr>
|
| 263 | <td class="td"><strong>overwrite</strong></td>
|
| 264 | <td class="td">FALSE</td>
|
| 265 | <td class="td">TRUE/FALSE (boolean)</td>
|
| 266 | <td class="td">If set to true, if a file with the same name as the one you are uploading exists, it will be overwritten. If set to false, a number will be appended to the filename if another with the same name exists.</td>
|
| 267 | </tr>
|
| 268 |
|
| 269 |
|
| 270 | <tr>
|
| 271 | <td class="td"><strong>max_size</strong></td>
|
| 272 | <td class="td">0</td>
|
| 273 | <td class="td">None</td>
|
| 274 | <td class="td">The maximum size (in kilobytes) that the file can be. Set to zero for no limit. Note: Most PHP installations have their own limit, as specified in the php.ini file. Usually 2 MB (or 2048 KB) by default.</td>
|
| 275 | </tr>
|
| 276 |
|
| 277 | <tr>
|
| 278 | <td class="td"><strong>max_width</strong></td>
|
| 279 | <td class="td">0</td>
|
| 280 | <td class="td">None</td>
|
| 281 | <td class="td">The maximum width (in pixels) that the file can be. Set to zero for no limit.</td>
|
| 282 | </tr>
|
| 283 |
|
| 284 | <tr>
|
| 285 | <td class="td"><strong>max_height</strong></td>
|
| 286 | <td class="td">0</td>
|
| 287 | <td class="td">None</td>
|
| 288 | <td class="td">The maximum height (in pixels) that the file can be. Set to zero for no limit.</td>
|
| 289 | </tr>
|
| 290 |
|
| 291 |
|
| 292 | <tr>
|
| 293 | <td class="td"><strong>encrypt_name</strong></td>
|
| 294 | <td class="td">FALSE</td>
|
| 295 | <td class="td">TRUE/FALSE (boolean)</td>
|
| 296 | <td class="td">If set to TRUE the file name will be converted to a random encrypted string. This can be useful if you would like the file saved with a name that can not be discerned by the person uploading it.</td>
|
| 297 | </tr>
|
| 298 |
|
| 299 | <tr>
|
| 300 | <td class="td"><strong>remove_spaces</strong></td>
|
| 301 | <td class="td">TRUE</td>
|
| 302 | <td class="td">TRUE/FALSE (boolean)</td>
|
| 303 | <td class="td">If set to TRUE, any spaces in the file name will be converted to underscores. This is recommended.</td>
|
| 304 | </tr>
|
| 305 | </table>
|
| 306 |
|
| 307 |
|
| 308 | <h2>Setting preferences in a config file</h2>
|
| 309 |
|
| 310 | <p>If you prefer not to set preferences using the above method, you can instead put them into a config file.
|
| 311 | Simply create a new file called the <var>upload.php</var>, add the <var>$config</var>
|
| 312 | array in that file. Then save the file in: <var>config/upload.php</var> and it will be used automatically. You
|
| 313 | will NOT need to use the <dfn>$this->upload->initialize</dfn> function if you save your preferences in a config file.</p>
|
| 314 |
|
| 315 |
|
| 316 | <h2>Function Reference</h2>
|
| 317 |
|
| 318 | <p>The following functions are available</p>
|
| 319 |
|
| 320 |
|
| 321 | <h2>$this->upload->do_upload()</h2>
|
| 322 |
|
admin | e334c47 | 2006-10-21 19:44:22 +0000 | [diff] [blame] | 323 | <p>Performs the upload based on the preferences you've set. Note: By default the upload routine expects the file to come from a form field
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 324 | called <dfn>userfile</dfn>, and the form must be a "multipart type:</p>
|
| 325 |
|
| 326 | <code><form method="post" action="some_action" enctype="multipart/form-data" /></code>
|
| 327 |
|
admin | ddd0c7d | 2006-09-05 04:05:33 +0000 | [diff] [blame] | 328 | <p>If you would like to set your own field name simply pass its value to the <dfn>do_upload</dfn> function:</p>
|
| 329 |
|
| 330 | <code>
|
| 331 | $field_name = "some_field_name";<br />
|
| 332 | $this->upload->do_upload($field_name)</code>
|
| 333 |
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 334 |
|
| 335 | <h2>$this->upload->display_errors()</h2>
|
| 336 |
|
| 337 | <p>Retrieves any error messages if the <dfn>do_upload()</dfn> function returned false. The function does not echo automatically, it
|
| 338 | returns the data so you can assign it however you need.</p>
|
| 339 |
|
| 340 | <h3>Formatting Errors</h3>
|
| 341 | <p>By default the above function wraps any errors within <p> tags. You can set your own delimiters like this:</p>
|
| 342 |
|
| 343 | <code>$this->upload->display_errors('<var><p></var>', '<var></p></var>');</code>
|
| 344 |
|
| 345 | <h2>$this->upload->data()</h2>
|
| 346 |
|
admin | e334c47 | 2006-10-21 19:44:22 +0000 | [diff] [blame] | 347 | <p>This is a helper function that returns an array containing all of the data related to the file you uploaded.
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 348 | Here is the array prototype:</p>
|
| 349 |
|
| 350 | <code>Array<br />
|
| 351 | (<br />
|
| 352 | [file_name] => mypic.jpg<br />
|
| 353 | [file_type] => image/jpeg<br />
|
| 354 | [file_path] => /path/to/your/upload/<br />
|
| 355 | [full_path] => /path/to/your/upload/jpg.jpg<br />
|
| 356 | [raw_name] => mypic<br />
|
| 357 | [orig_name] => mypic.jpg<br />
|
| 358 | [file_ext] => .jpg<br />
|
| 359 | [file_size] => 22.2<br />
|
| 360 | [is_image] => 1<br />
|
| 361 | [image_width] => 800<br />
|
| 362 | [image_height] => 600<br />
|
| 363 | [image_type] => jpeg<br />
|
| 364 | [image_size_str] => width="800" height="200"<br />
|
| 365 | )</code>
|
| 366 |
|
| 367 | <h3>Explanation</h3>
|
| 368 |
|
| 369 | <p>Here is an explanation of the above array items.</p>
|
| 370 |
|
| 371 | <table cellpadding="0" cellspacing="1" border="0" style="width:100%" class="tableborder">
|
| 372 | <tr><th>Item</th><th>Description</th></tr>
|
| 373 |
|
| 374 | <tr><td class="td"><strong>file_name</strong></td>
|
| 375 | <td class="td">The name of the file that was uploaded including the file extension.</td></tr>
|
| 376 |
|
| 377 | <tr><td class="td"><strong>file_type</strong></td>
|
| 378 | <td class="td">The file's Mime type</td></tr>
|
| 379 |
|
| 380 | <tr><td class="td"><strong>file_path</strong></td>
|
| 381 | <td class="td">The absolute server path to the file</td></tr>
|
| 382 |
|
| 383 | <tr><td class="td"><strong>full_path</strong></td>
|
| 384 | <td class="td">The absolute server path including the file name</td></tr>
|
| 385 |
|
| 386 | <tr><td class="td"><strong>raw_name</strong></td>
|
| 387 | <td class="td">The file name without the extension</td></tr>
|
| 388 |
|
| 389 | <tr><td class="td"><strong>orig_name</strong></td>
|
| 390 | <td class="td">The original file name. This is only useful if you use the encrypted name option.</td></tr>
|
| 391 |
|
| 392 | <tr><td class="td"><strong>file_ext</strong></td>
|
| 393 | <td class="td">The file extension with period</td></tr>
|
| 394 |
|
| 395 | <tr><td class="td"><strong>file_size</strong></td>
|
| 396 | <td class="td">The file size in kilobytes</td></tr>
|
| 397 |
|
| 398 | <tr><td class="td"><strong>is_image</strong></td>
|
| 399 | <td class="td">Whether the file is an image or not. 1 = image. 0 = not.</td></tr>
|
| 400 |
|
| 401 | <tr><td class="td"><strong>image_width</strong></td>
|
| 402 | <td class="td">Image width.</td></tr>
|
| 403 |
|
| 404 | <tr><td class="td"><strong>image_heigth</strong></td>
|
| 405 | <td class="td">Image height</td></tr>
|
| 406 |
|
| 407 | <tr><td class="td"><strong>image_type</strong></td>
|
| 408 | <td class="td">Image type. Typically the file extension without the period.</td></tr>
|
| 409 |
|
| 410 | <tr><td class="td"><strong>image_size_str</strong></td>
|
| 411 | <td class="td">A string containing the width and height. Useful to put into an image tag.</td></tr>
|
| 412 |
|
| 413 |
|
| 414 | </table>
|
| 415 |
|
| 416 | </div>
|
| 417 | <!-- END CONTENT -->
|
| 418 |
|
| 419 |
|
| 420 | <div id="footer">
|
| 421 | <p>
|
Derek Allard | 9da4dbc | 2007-04-03 11:39:35 +0000 | [diff] [blame] | 422 | Previous Topic: <a href="download_helper.html">Download Helper</a>
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 423 | ·
|
| 424 | <a href="#top">Top of Page</a> ·
|
| 425 | <a href="../index.html">User Guide Home</a> ·
|
admin | 3f643e6 | 2006-10-27 06:25:31 +0000 | [diff] [blame] | 426 | Next Topic: <a href="ftp.html">FTP Class</a>
|
Derek Allard | c644128 | 2007-07-04 23:54:32 +0000 | [diff] [blame] | 427 | </p>
|
Derek Jones | 7a9193a | 2008-01-21 18:39:20 +0000 | [diff] [blame^] | 428 | <p><a href="http://codeigniter.com">CodeIgniter</a> · Copyright © 2007 · <a href="http://ellislab.com/">Ellislab, Inc.</a></p>
|
admin | b0dd10f | 2006-08-25 17:25:49 +0000 | [diff] [blame] | 429 | </div>
|
| 430 |
|
| 431 | </body>
|
| 432 | </html> |