Welcome Guest, Not a member yet? Register   Sign In
uploading and using images
#7

[eluser]Dan Tdr[/eluser]
hey M4rc0.. i have a question... could you help?
in the upload library file we have something we may use.. but i don`t know hot to get the variable from there..

with the basic upload function found in the user guide from here : http://ellislab.com/codeigniter/user-gui...ading.html

after you sucesfully uploaded a file you get the following page with some data we could use:

Code:
<html>
<head>
<title>Upload Form</title>
</head>
<body>

<h3>Your file was successfully uploaded!</h3>

<ul>
<li>file_name: wc4.jpg</li>
<li>file_type: image/jpeg</li>
<li>file_path: E:/xphpx/xampp/htdocs/clasa/uploads/</li>

<li>full_path: E:/xphpx/xampp/htdocs/clasa/uploads/wc4.jpg</li>
<li>raw_name: wc4</li>
<li>orig_name: wc.jpg</li>
<li>file_ext: .jpg</li>
<li>file_size: 13.55</li>
<li>is_image: 1</li>
<li>image_width: 320</li>
<li>image_height: 301</li>
<li>image_type: jpeg</li>

<li>image_size_str: width="320" height="301"</li>
</ul>

<p><a href="http://localhost/clasa/index.php/upload.html">Upload Another File!</a></p>

&lt;/body&gt;
&lt;/html&gt;

so i found from were this info is outputed.. it`s from the Upload.php file in libraries
Code:
// --------------------------------------------------------------------
    
    /**
     * Finalized Data Array
     *    
     * Returns an associative array containing all of the information
     * related to the upload, allowing the developer easy access in one array.
     *
     * @access    public
     * @return    array
     */    
    function data()
    {
        return array (
                        'file_name'            => $this->file_name,
                        'file_type'            => $this->file_type,
                        'file_path'            => $this->upload_path,
                        'full_path'            => $this->upload_path.$this->file_name,
                        'raw_name'            => str_replace($this->file_ext, '', $this->file_name),
                        'orig_name'            => $this->orig_name,
                        'file_ext'            => $this->file_ext,
                        'file_size'            => $this->file_size,
                        'is_image'            => $this->is_image(),
                        'image_width'        => $this->image_width,
                        'image_height'        => $this->image_height,
                        'image_type'        => $this->image_type,
                        'image_size_str'    => $this->image_size_str,
                    );
    }
so we just need to get the file name or path.. i suggest we get the 'file_name' and store it into the database then when you want to display the image you could use something like :
[code]
&lt;?php
$upload_dir='uploads/' // your upload folder
foreach ($user_profile as $field=>$profile){?&gt;
<img src="&lt;?=base_url().$upload_dir.$profile?&gt;" />
&lt;?php } ?&gt;

i know this would work.. but i don`t know how to get if from the library.. and how to store it into the database.. could you guys help?


Messages In This Thread
uploading and using images - by El Forum - 09-14-2008, 08:24 AM
uploading and using images - by El Forum - 09-14-2008, 07:36 PM
uploading and using images - by El Forum - 09-16-2008, 01:51 PM
uploading and using images - by El Forum - 09-16-2008, 05:38 PM
uploading and using images - by El Forum - 09-17-2008, 03:00 AM
uploading and using images - by El Forum - 09-17-2008, 09:24 AM
uploading and using images - by El Forum - 09-17-2008, 09:39 AM
uploading and using images - by El Forum - 09-17-2008, 10:11 AM
uploading and using images - by El Forum - 09-17-2008, 10:55 AM
uploading and using images - by El Forum - 09-17-2008, 11:05 AM
uploading and using images - by El Forum - 09-17-2008, 11:19 AM
uploading and using images - by El Forum - 09-17-2008, 11:42 AM
uploading and using images - by El Forum - 09-17-2008, 12:16 PM
uploading and using images - by El Forum - 09-18-2008, 11:28 AM
uploading and using images - by El Forum - 09-19-2008, 06:20 AM
uploading and using images - by El Forum - 09-19-2008, 06:36 AM
uploading and using images - by El Forum - 09-19-2008, 06:38 AM
uploading and using images - by El Forum - 09-19-2008, 07:00 AM
uploading and using images - by El Forum - 09-19-2008, 07:08 AM
uploading and using images - by El Forum - 09-19-2008, 07:09 AM
uploading and using images - by El Forum - 09-19-2008, 07:11 AM
uploading and using images - by El Forum - 09-19-2008, 07:12 AM
uploading and using images - by El Forum - 09-19-2008, 07:19 AM
uploading and using images - by El Forum - 09-19-2008, 07:21 AM
uploading and using images - by El Forum - 09-19-2008, 09:13 AM
uploading and using images - by El Forum - 09-20-2008, 12:54 PM
uploading and using images - by El Forum - 09-20-2008, 02:46 PM
uploading and using images - by El Forum - 09-20-2008, 03:11 PM
uploading and using images - by El Forum - 09-20-2008, 03:28 PM
uploading and using images - by El Forum - 09-20-2008, 03:59 PM
uploading and using images - by El Forum - 09-20-2008, 04:10 PM
uploading and using images - by El Forum - 09-20-2008, 04:32 PM
uploading and using images - by El Forum - 09-20-2008, 05:41 PM
uploading and using images - by El Forum - 09-22-2008, 01:35 PM
uploading and using images - by El Forum - 09-22-2008, 01:59 PM
uploading and using images - by El Forum - 09-22-2008, 02:01 PM
uploading and using images - by El Forum - 09-23-2008, 02:57 AM
uploading and using images - by El Forum - 09-23-2008, 03:02 AM
uploading and using images - by El Forum - 09-23-2008, 03:19 AM
uploading and using images - by El Forum - 09-23-2008, 03:24 AM
uploading and using images - by El Forum - 09-23-2008, 03:38 AM
uploading and using images - by El Forum - 09-23-2008, 03:47 AM
uploading and using images - by El Forum - 09-23-2008, 04:16 AM
uploading and using images - by El Forum - 09-23-2008, 04:21 AM
uploading and using images - by El Forum - 09-23-2008, 10:11 AM



Theme © iAndrew 2016 - Forum software by © MyBB