I have seen in many applications where user is restricted to choose particular option only when user is trying to upload something..!!

For example if user is uploading image..he only see 2 options JPG and GIF format in file type option of Browser Window..!!

How can i do the same thing..!!

Waiting for Positive reply..!! :)

Recommended Answers

All 2 Replies

Due to the way the HTML file selector works it is not possible to do this through only HTML/PHP
However...
It is possible through Flash
There is a brilliant up-loader here - http://swfupload.org/
It allows you to specify file type as well as showing a progress bar

There is a way to specify this in HTML, but not all browsers adhere to it. Use the attribute accept in the <form> tag. Assign it comma-separated MIME types. For example:

<form accept="image/gif,image/jpeg" enctype="multipart/form-data" action="upload.php" method="post">

See http://www.w3.org/TR/html401/interact/forms.html#h-17.3 for more information.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.