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

  • Home
  • SEARCH
  • 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 9204077
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T23:37:17+00:00 2026-06-17T23:37:17+00:00

I am using codeigniter to create the admin panel of my website. I am

  • 0

I am using codeigniter to create the admin panel of my website. I am not using it for the front end because I have lots of static pages in the front end and only a few things need to be dynamic so I will be doing it with core PHP queries.

My link for unlinking photo is , images is the controller and unlinkPhoto is the function and 32 is the image ID.

localhost/admin/index.php/images/unlinkPhoto/32

EDIT

however my image is located at localhost/uploads/testimage.jpg.
How can I point to that folder to unlink the image in codeigniter.

  • 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-06-17T23:37:18+00:00Added an answer on June 17, 2026 at 11:37 pm

    You really need to make sure you’re enforcing decent security protocols, otherwise anyone can fake the GET request and delete the entirety of your uploaded files. Here is a basic solution:

    public function unlinkPhoto($photoId)
    {
       // Have they specified a valid integer?
       if ((int) $photoId > 0) {
          foreach (glob("uploads/*") as $file) {
             // Make sure the filename corresponds to the ID
             // Caters for all file types (not just JPGs)
             $info = pathinfo($file);
             if ($info['filename'] == $photoId) {
                unlink($file);
             }
          }
       }
    }
    

    If you’re using PHP 5.4, you might be able to reduce this code down even more:

    if (pathinfo($file)['filename'] == $photoId) {
       unlink($file);
    }
    

    Because they’ve implemented array dereferencing (finally). Although I haven’t tested this particular piece of code. This is just a geeky addendum.

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

Sidebar

Related Questions

Currently I have create a website using codeigniter. I got a message error every
i am using codeigniter 2.1.0 and mysql database. in my admin panel i have
I'm developing a simple app with a CRUD admin panel, using CodeIgniter. One of
I'm using Codeigniter framework to create my web application. I have a login form
I'm using Codeigniter framework to create my web application. I have a login form
I have two tables, categories and products. I am using CodeIgniter. Categories CREATE TABLE
I want to create an E-commerce website. So it will have 2 sides. Front
I am trying to create a URL shortener using CodeIgniter 2. I have 2
Hi i'm new to codeigniter. I have developed this website using CI. http://maxmovies.in/fattto Now
I am trying to create a Content Management System using Codeigniter. I have a

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.