Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6789909
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:39:42+00:00 2026-05-26T17:39:42+00:00

I wanted to follow up on a question I previously asked which I’m still

  • 0

I wanted to follow up on a question I previously asked which I’m still not able to answer.

To summarize, the goal for www.mysite.com/uploads is to have “uploads” double as both a php controller and a directory.

The answer given by user “anonymous” about writing some authentication in the “uploads” controller constructor is what I’ve tried to do but it is not working yet for me.

I’m returning each content’s details including its src="" directory location via a controller named “content”:

/content/account_id# (e.g., 3)/item_id# ((e.g., 2)

In the www.mysite.com/content/3/2 view file, I like to play the content, e.g., a video file, via the aforementioned video tag’s src attribute. In this case, src="/uploads/3/2/my_video.m4v".

Here’s my uploads controller code so far:

class Uploads extends CI_Controller {

function Uploads()
{
  parent::__construct();

      $account_id= $this->session->userdata('account_id'); // =3 in this example
      $item_id=$this->uri->segment('3'); // =2 in this example
      $this->db->select('*');
      $this->db->from('items');
      $this->db->where('account_id, $account_id)->where('item_id, $item_id);
      $query=$this->db->get();

      if(empty($query){ return false; }
      else { return true; }
    }
 }

As you can see from the “items” table query, I’m aiming for the scenario where, if a given account_id doesn’t own a given item_id, then they don’t get access to the indicated “uploads” sub-directory.

However, this code is clearly not doing anything because if anyone, not just the user with account_id=3, goes to www.mysite.com/uploads/3/2/my_video.m4v, they can still access this video (it is downloaded by Firefox, safari, and played by natively by chrome).

Any thoughts one might have would be greatly appreciated!

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-26T17:39:43+00:00Added an answer on May 26, 2026 at 5:39 pm

    You need to restrict direct access by using an .htaccess file.

    Then you have to create a function in your controller that streams the file via PHP after the user has been authorized.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This is a follow-up question to a different question I asked not too long
This is a follow-up from this question . Functions are not allowed to write
This is a follow-up of this question . I wanted to plot multiple curves
A persistent follow-up of an admittedly similar question I had asked: What security restrictions
This is in a way a follow-up of a previously unanswered question of mine
If I wanted the follow button to display, Follow + username (with username being
I wanted to follow some excellent C++ advice of calculating the array length once
This is a follow-up of this question on here http://iphonedevelopment.blogspot.com/2010/02/drawing-hud-display-in-opengl-es.html It tackles on the
This question might be off topic, but I wanted to ask the fellow developers.
I'm a newcomer to JSF and am still trying to follow examples to learn

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.