Welcome Guest, Not a member yet? Register   Sign In
pass an associative array containing data to form_upload
#1

[eluser]edziffel[/eluser]
Am trying to pass attributes using an array with form_upload. The bare bones of it works.

Read the user guide where they the example shows an $data array to pass the arguments. However I am using $data arrays for page titles, headers and what have you.

Code:
function db_upload_form()
        {
            $data['title']="Database Upload Form";
            $data['heading']="Click Browse to select CSV File to upload";
            $data['directions']="Click Upload after selecting file";
            /*$data=array('action'=> 'db_upload_post_to_view');*/
            $this->load->view('db_upload_form_view',$data);
        }

The commented out line is one of my many attempts to pass an attribute to the form_upload function.
Am not married to the many $data arrays but does allow for a user friendly to change things.

Code for db_upload_form_view.php

Code:
<!DOCTYPE html>
&lt;html&gt;
&lt;head&gt;
&lt;meta charset="utf-8" /&gt;
&lt;title&gt;&lt;?php echo $title;?&gt;&lt;/title&gt;
&lt;/head&gt;
&lt;body&gt;
&lt;?php echo $heading."<br/>"; ?&gt;
&lt;?php echo $directions."<br/>"; ?&gt;
&lt;?php echo form_upload(); ?&gt;

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

Yeah the argument section of form_upload, (), is blank at the moment because that way for the moment it is working. Shows the title, heading, directions and just/only a small text box and a browse button.

What do I need to do to pass the proper attributes to the function to get things like a submit button to work? Is there a way to make the included text box large enough to be able to show the entire URL before submitting? Is there a way to change the text on the browse button?

Thanks
#2

[eluser]edziffel[/eluser]
Was looking at the post Multiple File Upload in the forum. Apparently I'm missing a lot. Followed the code okay but don't really see how I could get there based on the info on the site. Like is the associative array supposed to be on the view page with the function call? Also not sure how to use the library properly. Where do I need to look to for that info? Are their other resources for learning code igniter?

Doing gee I don't know so let's try it 27 different ways is a non starter. For instance I already did the full application using just functions but wanted to put it in code igniter. What's the best way to attempt to master CI?




Theme © iAndrew 2016 - Forum software by © MyBB