Welcome Guest, Not a member yet? Register   Sign In
Jquery + file upload problems
#3

[eluser]DanTheMan[/eluser]
Hi,

First, thanks for your reply.. That will be very useful to know and will help me alot in further development.

However, I don't see how it helps with my problem. Maybe I did not explain myself well to begin with.

I have a view, which uses javascript to post the user submission. This is so that the page does not need to be reloaded (its in tabs).

I use the following javascript to post this.

Code:
$('#detail_form').submit(function()
    {

    var form_data = {
        ajax:             1,
        name:             $('#name').val(),
        type:             $('#type').val(),
        num_guests:     $('#num_guests').val(),
        userfile:        $('#userfile').val(),
        min_stay:         $('#min_stay').val()
    };
        $.ajax(
        {
            type: 'POST',
            data: form_data,
            url: "<?php echo site_url('accomodation/add_details'); ?>",
            success: function(msg){
            if(msg == 1){
                [removed]('dashboard');
            }else{
                $('#error_messages').html(msg);
            }
                }
        });
        return false;
    });

I then go through general validation. If this validation passes I then move onto the posting of the file (in this case an image). This calls the model where I am doing my file submission.

Code:
if(! $this->upload->do_upload())
            {
                // wooops, there has been a problem
                //$error = $this->upload->display_errors();
                $data['error'] = $this->upload->display_errors();
                $data['status'] = FALSE;
                return $data;
            } else { //do something else... and move onto the manipulation..

The problem is, jquery does not submit the full path of the submission (I believe due to security issues). So even if the user submits a file, it says they have not. I have checked the post and for example, i can see this....

Code:
Parametersapplication/x-www-form-urlencoded
ajax    1
min_stay    1
name    Daniel
num_guests    1
type    whatever
userfile    random b&B capture.jpg
Source
ajax=1&name=Daniel&type=whatever&num_guests=1&userfile=random+b&B+capture.jpg&min_stay=1

I don't know how to make the file upload library in CI understand what is being submit.

Thanks again for your help! ;-)


Messages In This Thread
Jquery + file upload problems - by El Forum - 03-22-2011, 12:37 PM
Jquery + file upload problems - by El Forum - 03-22-2011, 01:41 PM
Jquery + file upload problems - by El Forum - 03-22-2011, 02:03 PM
Jquery + file upload problems - by El Forum - 03-23-2011, 02:45 AM
Jquery + file upload problems - by El Forum - 03-27-2011, 05:21 PM
Jquery + file upload problems - by El Forum - 03-27-2011, 05:56 PM
Jquery + file upload problems - by El Forum - 03-27-2011, 10:35 PM
Jquery + file upload problems - by El Forum - 03-28-2011, 01:03 PM
Jquery + file upload problems - by El Forum - 03-28-2011, 02:08 PM
Jquery + file upload problems - by El Forum - 03-29-2011, 06:24 AM
Jquery + file upload problems - by El Forum - 03-29-2011, 08:30 AM
Jquery + file upload problems - by El Forum - 03-29-2011, 08:31 AM
Jquery + file upload problems - by El Forum - 03-29-2011, 12:39 PM



Theme © iAndrew 2016 - Forum software by © MyBB