Welcome Guest, Not a member yet? Register   Sign In
Uploading files - Passing a variable in the url


Take a look at this example please. Notice I add the $album_id to the end of the url on the manage photos link.

I want to create a page where the uploaded photo's is inserted in to the database along with the user_id and group_id. Getting the user_id is easy as it's in the session. The group_id must be pulled from the url. Easy enough.

However, I add a security check on page load to see if the user has admin over that album.

if (!logged_in()) {
        } elseif (!$this->uri->segment(3)) {
            show_error('No Album ID passed.');
        } elseif (!$this->photo_model->author_check($this->session->userdata('user_id'), $this->uri->segment(3))) {
            show_error('Only album authors may upload code.');
        } else {
            $this->session->set_flashdata('album_id', $this->uri->segment(3));

When I go to submit the form the url changes to url.com/photos/upload/upload changing the 3rd uri segment to upload.

I cannot think of any way around this problem. Do you have any suggestions?

Theme © iAndrew 2016 - Forum software by © MyBB