Forum Moderators: phranque

Message Too Old, No Replies

upload to htaccess protected directory problem

upload gets a 403 error

         

cracker243

3:27 pm on Dec 18, 2008 (gmt 0)

10+ Year Member



hi all,

first up, i don't know a lot about htaccess and have been looking everywhere i could think of but can't find a solution...

i have a flash uploader in home/user/domains/domain.com/html/uploads.
it uploads a file to the home/user/data/tmp directory.
then a php script is supposed to move the uploaded file to the designated directory at home/user/domains/domain.com/html/uploads/images.

the problem is that the root directory (home/user/domains/domain.com/html) is protected by an htaccess file.

here is the code from the htaccess file:


AuthType Basic
AuthName "Protected Area"
AuthUserFile /home/user/domains/domain.com/html/.htpasswd
AuthGroupFile dev/null
Require user user_1 user_2 user_3

when i upload a file it seems to get uploaded to the tmp directory, but then i get an 401 error. i think that means that the file can not be move to the images directory because access to it is restricted.

i tried to change the the location of the tmp directory with a custom php.ini file.
i tried to add the lines


SetEnvIfNoCase Referer .domain\.com good_pass
Allow from env=good_pass

to the htacces file, but it does not make any difference...

if anyone could help me find a way to make this work i'd be very grateful.

thanks.

cracker243

5:14 pm on Dec 18, 2008 (gmt 0)

10+ Year Member



i found a solution.

now the htacces file in home/user/domains/domain.com/html looks like this:


AuthType Basic
AuthName "Protected Area"
AuthUserFile /home/user/domains/domain.com/html/.htpasswd
AuthGroupFile dev/null
Require user user_1 user_2 user_3
Satisfy All

then i put another htaccess file in the home/user/domains/domain.com/html/uploads directory that looks like this:


AuthType Basic
AuthName "Protected Area"
AuthUserFile /home/user/domains/domain.com/html/.htpasswd
AuthGroupFile dev/null
Require user user_1 user_2 user_3
Satisfy Any

note the difference of the last line.

that did it for me.