Note that there are some explanatory texts on larger screens.

plurals
  1. POHow can i send image name upload controller to resister controller
    primarykey
    data
    text
    <p>View code</p> <pre><code>&lt;form id="form1" method="post" enctype="multipart/form-data" action='&lt;?php echo base_url();?&gt;index.php/setup_con/upload'&gt; &lt;input type="file" name="userfile" id="userfile" required="required"/&gt; &lt;/form&gt; &lt;form id="form2" method="post" enctype="multipart/form-data" action='&lt;?php echo base_url();?&gt;index.php/setup_con/register'&gt; &lt;input type="text" name="name" id="name"/&gt; &lt;input type="text" name="city" id="city"/&gt; &lt;input type="text" name="mobile" id="mobile"/&gt; &lt;input type="submit" value="Submit" /&gt; &lt;/form&gt; </code></pre> <p>controller code</p> <pre><code>function upload() { $config['upload_path'] = './uploads/'; $config['allowed_types'] = 'gif|jpg|png'; $config['max_size'] = '800'; $config['max_width'] = '1024'; $config['max_height'] = '768'; $this-&gt;load-&gt;library('upload', $config); if (!$this-&gt;upload-&gt;do_upload()) { echo "File is Not valid/File does not select"; $error = array('error' =&gt; $this-&gt;upload-&gt;display_errors()); } else { $data = array('upload_data' =&gt; $this-&gt;upload-&gt;data()); $img_name = $data ['upload_data']['file_name']; echo "'&lt;img src='".base_url()."uploads/".$img_name."' class='preview'&gt;"; } } function register() { $this-&gt;form_validation-&gt;set_rules('name','Name', 'trim|required'); $this-&gt;form_validation-&gt;set_rules('city','city', 'trim|required'); $this-&gt;form_validation-&gt;set_rules('mobile','mobile', 'trim|required'); if($this-&gt;form_validation-&gt;run() == FALSE) { } else { $data = $this-&gt;register_model-&gt;register(); } } </code></pre> <p>I have upload image from first form using ajax in codeigniter which controller is upload,here will be upload only image this controller but i would like to image name to send register controller which i will insert image_name, name, city and monbile in resister table.</p> <p>Please help me,</p> <p>How can i do it successfully </p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload