Forum Moderators: bakedjake

Message Too Old, No Replies

Allowing access to .gif/.jpg only

         

Ian Cunningham

4:24 pm on Sep 16, 2003 (gmt 0)

10+ Year Member



I have a directory on my server, where I only want .gif/.jpg files to be uploaded (or at least only those are able to be run). This is to stop people from uploading .php and .cgi to this public dir.

Do you have any ideas how I can do this?

I thought putting <FilesMatch "\.(gif¦jpe?g)$"> in an htaccess, but I dont know if that works? Would it need to be in my root?

bcolflesh

4:27 pm on Sep 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Did you chmod off execute on that directory?

Ian Cunningham

4:32 pm on Sep 16, 2003 (gmt 0)

10+ Year Member



nope?

Would I still be able to access the .gif/.jpg files?

Ian Cunningham

4:34 pm on Sep 16, 2003 (gmt 0)

10+ Year Member



ok, just tried that, I can't get to the .jpg / .gif that way

bcolflesh

4:45 pm on Sep 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry - bad answer - what protocol are people using to upload files? FTP, SMB? Most FTP servers have configuration options to set a umask for a directory or a disallowed file list - SMB has similar options -

Ian Cunningham

5:00 pm on Sep 16, 2003 (gmt 0)

10+ Year Member



I would be using FTP via internet explorer

I basically want a very very simple way for people to upload .gif/.jpg only files to a directory and be able to create subdirectories.

Ideally, I would just create a .htaccess to allow .gif .jpg to only be allowed

too much information

5:05 pm on Sep 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



why don't you run a check on the name of the file they are trying to upload and only let files go up that end in .gif/.jpg?

if you are still unsure after that you could set up a system that does not make the files available until they are approved. It's more work for you, but you could be sure that there are no tricksters messing with your site.

bcolflesh

5:06 pm on Sep 16, 2003 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Check out the manual for the FTP server that is running on the box - it will have the info you need.

Ian Cunningham

5:31 pm on Sep 16, 2003 (gmt 0)

10+ Year Member



Its only a cpanel interface on apache, so I have limited access I'm afraid... I know there is a way via htaccess, I just can't figure out how to use the correct variables?