Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File Upload....

Status
Not open for further replies.

neomorpheus

Programmer
Mar 9, 2001
47
US
I have a form which has 1.) a file upload field and 2.) a dropdown that lists diffrent file extensions.

Right now users have to use the file upload to select the file they want to upload AND in the dropdown list for file type/extensions need to pull the right file type. The code is so written, so changing the whole thing is out of question.

What i want now??

Once the file to be uploaded is selected, the path is displayed in the textbox. I want to be able to extract the file extension of the selected file and populate the dropdown below with the three character extension.

Can anybody help me with this??

Thanks
 
Clarification:

"I have a form which has 1.) a file upload field and 2.) a dropdown that lists diffrent file extensions."

The dropdown list is NOT the file upload dialog box..

Basically the form has a dropdown box with a list of file extensions. If a user forgets to pick the corresponding file extension of the file he wants to upload, then the default file extension gets added to the file name and gets uploaded.

So i am trying to work around that. When a file Try.TXT is seleted for upload, the code should automatically populate the dropdwon below with .TXT :)
 
function getExtension(formElement)
{
var extensionRegExp = /\..?.?.?/
extensionRegExp.test(formElement.value)
return RegExp.$1
}

this gets the value from a form element, checks to see if the value has an extension and returns it.

Why do you have a pulldown menu to know the file extension?

Hope this helps. Gary Haran
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top