From 114ab0988e20ac6be39ad363ff897a1a3b85e565 Mon Sep 17 00:00:00 2001 From: Razican Date: Mon, 25 Apr 2011 17:26:45 +0200 Subject: Fixed double-space typo. --- user_guide/libraries/file_uploading.html | 58 ++++++++++++++++---------------- 1 file changed, 29 insertions(+), 29 deletions(-) (limited to 'user_guide/libraries/file_uploading.html') diff --git a/user_guide/libraries/file_uploading.html b/user_guide/libraries/file_uploading.html index e4e842e5f..a248267ae 100644 --- a/user_guide/libraries/file_uploading.html +++ b/user_guide/libraries/file_uploading.html @@ -58,7 +58,7 @@ File Uploading Class

File Uploading Class

-

CodeIgniter's File Uploading Class permits files to be uploaded. You can set various +

CodeIgniter's File Uploading Class permits files to be uploaded. You can set various preferences, restricting the type and size of the files.

@@ -80,7 +80,7 @@ preferences, restricting the type and size of the files.

-

Using a text editor, create a form called upload_form.php. In it, place this code and save it to your applications/views/ +

Using a text editor, create a form called upload_form.php. In it, place this code and save it to your applications/views/ folder:

@@ -106,8 +106,8 @@ folder:

</body> </html> -

You'll notice we are using a form helper to create the opening form tag. File uploads require a multipart form, so the helper -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 +

You'll notice we are using a form helper to create the opening form tag. File uploads require a multipart form, so the helper +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 the user does something wrong.

@@ -138,7 +138,7 @@ In it, place this code and save it to your applications/views/ fold

The Controller

-

Using a text editor, create a controller called upload.php. In it, place this code and save it to your applications/controllers/ +

Using a text editor, create a controller called upload.php. In it, place this code and save it to your applications/controllers/ folder:

@@ -162,8 +162,8 @@ class Upload extends CI_Controller { $config['upload_path'] = './uploads/'; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = '100'; - $config['max_width'] = '1024'; - $config['max_height'] = '768'; + $config['max_width'] = '1024'; + $config['max_height'] = '768'; $this->load->library('upload', $config); @@ -186,7 +186,7 @@ class Upload extends CI_Controller {

The Upload Folder

-

You'll need a destination folder for your uploaded images. Create a folder at the root of your CodeIgniter installation called +

You'll need a destination folder for your uploaded images. Create a folder at the root of your CodeIgniter installation called uploads and set its file permissions to 777.

@@ -215,26 +215,26 @@ controller is correct it should work.

Setting Preferences

-

Similar to other libraries, you'll control what is allowed to be upload based on your preferences. In the controller you +

Similar to other libraries, you'll control what is allowed to be upload based on your preferences. In the controller you built above you set the following preferences:

$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'gif|jpg|png';
$config['max_size'] = '100';
-$config['max_width'] = '1024';
-$config['max_height'] = '768';
+$config['max_width'] = '1024';
+$config['max_height'] = '768';

$this->load->library('upload', $config);

-// Alternately you can set preferences by calling the initialize function. Useful if you auto-load the class:
+// Alternately you can set preferences by calling the initialize function. Useful if you auto-load the class:
$this->upload->initialize($config);
-

The above preferences should be fairly self-explanatory. Below is a table describing all available preferences.

+

The above preferences should be fairly self-explanatory. Below is a table describing all available preferences.

Preferences

-

The following preferences are available. The default value indicates what will be used if you do not specify that preference.

+

The following preferences are available. The default value indicates what will be used if you do not specify that preference.

@@ -248,14 +248,14 @@ $this->upload->initialize($config); - + - + @@ -264,7 +264,7 @@ $this->upload->initialize($config); @@ -280,28 +280,28 @@ $this->upload->initialize($config); - + - + - + - + @@ -323,7 +323,7 @@ $this->upload->initialize($config);

Setting preferences in a config file

If you prefer not to set preferences using the above method, you can instead put them into a config file. -Simply create a new file called the upload.php, add the $config +Simply create a new file called the upload.php, add the $config array in that file. Then save the file in: config/upload.php and it will be used automatically. You will NOT need to use the $this->upload->initialize function if you save your preferences in a config file.

@@ -335,7 +335,7 @@ will NOT need to use the $this->upload->initialize function if you sa

$this->upload->do_upload()

-

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 +

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 called userfile, and the form must be a "multipart type:

<form method="post" action="some_action" enctype="multipart/form-data" /> @@ -349,11 +349,11 @@ $this->upload->do_upload($field_name)

$this->upload->display_errors()

-

Retrieves any error messages if the do_upload() function returned false. The function does not echo automatically, it +

Retrieves any error messages if the do_upload() function returned false. The function does not echo automatically, it returns the data so you can assign it however you need.

Formatting Errors

-

By default the above function wraps any errors within <p> tags. You can set your own delimiters like this:

+

By default the above function wraps any errors within <p> tags. You can set your own delimiters like this:

$this->upload->display_errors('<p>', '</p>'); @@ -403,7 +403,7 @@ Here is the array prototype:

- + @@ -415,7 +415,7 @@ Here is the array prototype:

- + @@ -424,10 +424,10 @@ Here is the array prototype:

- + - +
upload_path None NoneThe path to the folder where the upload should be placed. The folder must be writable and the path can be absolute or relative.The path to the folder where the upload should be placed. The folder must be writable and the path can be absolute or relative.
allowed_types None NoneThe 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.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.
None Desired file name -

If set CodeIgniter will rename the uploaded file to this name. The extension provided in the file name must also be an allowed file type.

+

If set CodeIgniter will rename the uploaded file to this name. The extension provided in the file name must also be an allowed file type.

max_size 0 NoneThe 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.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.
max_width 0 NoneThe maximum width (in pixels) that the file can be. Set to zero for no limit.The maximum width (in pixels) that the file can be. Set to zero for no limit.
max_height 0 NoneThe maximum height (in pixels) that the file can be. Set to zero for no limit.The maximum height (in pixels) that the file can be. Set to zero for no limit.
max_filename 0 NoneThe maximum length that a file name can be. Set to zero for no limit.The maximum length that a file name can be. Set to zero for no limit.
The file name without the extension
orig_nameThe original file name. This is only useful if you use the encrypted name option.
The original file name. This is only useful if you use the encrypted name option.
client_name The file name as supplied by the client user agent, prior to any file name preparation or incrementing.
The file size in kilobytes
is_imageWhether the file is an image or not. 1 = image. 0 = not.
Whether the file is an image or not. 1 = image. 0 = not.
image_width Image width.
Image height
image_typeImage type. Typically the file extension without the period.
Image type. Typically the file extension without the period.
image_size_strA string containing the width and height. Useful to put into an image tag.
A string containing the width and height. Useful to put into an image tag.
-- cgit v1.2.3-24-g4f1b