Welcome Guest, Not a member yet? Register   Sign In
help me about CI + Jquery mobile
#1

[eluser]firexas[/eluser]
hello all,

i'm newbie on codeigniter and i build web mobile version with CI(2.0)and jquery mobile 1.0.
my question..
how to upload my image files like jpeg,gif and others on my source code?!

i try with CI without jquery mobile.sucess but with jquery mobile not sucess. why?

this my sourcode.

//controller.

function save_article()

{
$this->load->library("upload");
$config['upload_path'] = './uploads/';
$config['allowed_types'] = 'jpeg|gif|jpg|png';
$config['max_size'] = '10000';
$config['max_width'] = '1024';
$config['max_height'] = '1768';
$this->upload->initialize($config);
$field_name = "foto";

if (!$this->upload->do_upload($field_name))
{
$upload_error = array("error" => $this->upload->display_errors());
print_r($upload_error);
//$this->load->view("form_insert_siswa", $upload_error);
}
else
{
$upload_data = $this->upload->data();
$rec_data = array("nmbio" => $this->input->post("namabio"),
"isi" => $this->input->post("article"),
"gbr" => $upload_data["full_path"]);
$this->db->insert("review", $rec_data);

}

//view
<div data-role="collapsible" data-theme="b" data-content-theme="d">
<h3 id="according_sent_article">Kirim Article Biologi</h3>
<p id="kirim_article">
&lt;?php echo form_open_multipart('mobile/save_article','name="f_article"') ?&gt;


<ul>
<label for='namabio'>NameBiologi :</label>
&lt;input type='text' name='namabio' id='namabio' value='' /&gt;



<label for='article'>Article :</label>
&lt;textarea name="article" id="article"&gt; &lt;/textarea&gt;




<label for='foto'> Image :</label>
&lt;input type="file" name="foto" id='foto' value=''&gt;



</ul>
<a class='mybutton' data-role="button">sent Article Biologi</a>
&lt;/form&gt;






//mobile.js

$(document).bind("mobileinit", function(){
$.mobile.loadingMessage = "Mohon tunggu...";

});


function simpan_article()
{


$('#info-content').text('Loading...');
var namabio = $('#namabio').val();
$('label[for=namabio]').removeClass('error');
if(namabio == '')
{
$('label[for=namabio]').addClass('error');
}
else
{
send_form(document.f_article,'mobile/save_article');
}
}



..
my source code like that.help me?

thanks b4 and sory my english not good.




Theme © iAndrew 2016 - Forum software by © MyBB