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 529983
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 13, 20262026-05-13T09:08:55+00:00 2026-05-13T09:08:55+00:00

i have a form which allows the user to upload some files to a

  • 0

i have a form which allows the user to upload some files to a folder.

i’ve edit the .htaccess file in that directory to protect this folder from allowing the unwanted visitors to download the contents manually by typing the full url
ex:
http://www.bkabkabka.com/a/b/c/document.pdf

and this is the .htaccess data

Options All -Indexes
<FilesMatch "\.(htaccess|doc|pdf|docx)$">
 Order Allow,Deny
 Deny from all

i have another administration page which allows the responsible guy from our side to download the files by filtering them to anything he want and then click on a html link to normally download the files.
ex:

id             name          filename
1             aaaaa     -->  filename1   <-- this is href link which contains for example http://www.bkabkabka.com/a/b/c/2.doc

the problem is that the htaccess modification is applying globaly and i want to create like a username and password to this folder and then use PHP code to connect to this folder and be able to download the files normally.

how can i do that?

thank you.

  • 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-13T09:08:55+00:00Added an answer on May 13, 2026 at 9:08 am

    the easiest way to password protect a directory with apache is htpasswd:

    add to your .htaccess in the root dir of the protected directory tree:

    AuthUserFile /home/user/www/protected/.htpasswd
    AuthType Basic
    AuthName "Protected"
    Require valid-user
    

    then run this from the comand line and enter the desired password:

    htpasswd -c /home/user/www/protected/.htpasswd user
    

    you can add another user like so:

    htpasswd /home/user/www/protected/.htpasswd user2
    

    to download files in this protected dir with php, use basic authentication. that is construct a url like so: http://user:password@server/protected/file.txt

    re your comment, in cpanel there’s a “Password Protect Directories” feature accessible from the main page. Here’s some detail on that:

    http://www.siteground.com/tutorials/cpanel/pass_protected_directories.htm

    if you’re planning to store the uploaded files in your protected directory, you would just want to make sure move_uploaded_file copies the file to the right path, e.g.:

    move_uploaded_file($tmpPath, "/home/user/www/protected/$name");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Ask A Question

Stats

  • Questions 316k
  • Answers 316k
  • Best Answers 0
  • User 1
  • Popular
  • Answers
  • Editorial Team

    How to approach applying for a job at a company ...

    • 7 Answers
  • Editorial Team

    What is a programmer’s life like?

    • 5 Answers
  • Editorial Team

    How to handle personal stress caused by utterly incompetent and ...

    • 5 Answers
  • Editorial Team
    Editorial Team added an answer I found the answer. To check, use <</T(c1)/V(Yes)>> To turn… May 13, 2026 at 11:35 pm
  • Editorial Team
    Editorial Team added an answer Suppose you have two divs with id's rendered and source:… May 13, 2026 at 11:35 pm
  • Editorial Team
    Editorial Team added an answer Since the Wait() method is releasing and reacquiring the Monitor… May 13, 2026 at 11:35 pm

Related Questions

Update: The problem ended up being the Flash component itself. It wasn't properly compiling
I was asked to post this as a question on StackOverflow by http://twitter.com/jonathanjulian which
I have a file upload function in my asp.net mvc application that allows users
I have a rails app that has picked up a bit of traction, but
Is there a way to get the Content-Type of the response or conversely set

Trending Tags

analytics british company computer developers django employee employer english facebook french google interview javascript language life php programmer programs salary

Top Members

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.