views:

66

answers:

3

Is there a way to restrict the user to a folder on the server when they choose to browse for a file using the input type=file button?

for example: If you have images you want the user to choose from that only exist in the server's image folder to prevent them from search for and uploading their own images.

+1  A: 

When the user browses using an input file, he browses his own filesystem. So I don't see how you can restrict them to searching what is on the server. Also, what is the purpose of the file input if the users can't upload files ?

nc3b
basically, I want the user to choose from a group of images on my server as apposed to their own system. Most of the wording used is because I don't know how else to explain what I want to do in common terms.
dcp3450
Then I believe you will have to do something custom. Perhaps a nice gallery where users can click on photos they see ?
nc3b
A: 

So your use-case is to have the user select an image for something in a web application?

Then a form with an input of type=file is not what you need.

A form is filled with data in the context of the user's browser on her computer. That means the user has access to files on that computer and cannot access the server where the web application is running. What you probably want is a page that is generated on the server and filled with the available images or that provides a search function for available images.

Correct me if I'm wrong :)

Martin Klinke
A: 

When you want the user to select images from somewhere on the server you wouldn't use a file upload anyway, as they are already on the server.

Show the images one after the other with a radio button or something besides it.

Marian