p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   ASP.NET 1.0 and 1.1 Basics (http://p2p.wrox.com/forumdisplay.php?f=60)
-   -   Queries On File Field Html Control in ASP.NET 1.1 (http://p2p.wrox.com/showthread.php?t=49598)

daffodils October 30th, 2006 06:42 AM

Queries On File Field Html Control in ASP.NET 1.1
 
Hi frenz,
I'm using a File field control to browse and get the path of a file. I can also validate for the type of file I want to browse. Like I'm using the regular expression validator as

'----this is the file field control-----
<INPUT id="fn" type="file" name="fn" runat="server">
'-----this is the validator for fn-----
<asp:RegularExpressionValidator
id="REVV" runat="server"
ErrorMessage="Hello not a pic"
ControlToValidate="fn"
ValidationExpression="^(([a-zA-Z]:
)|(\\{2}\w+)\$?)(\\(\w[\w].*))+
(.bmp|.jpeg|.png|.gif|.avi)">
</asp:RegularExpressionValidator>

but what I want is that :-

1> to open a particular folder exsisting in my website (http:\\localhost\\website ) in the website folder in wwwroot whenever the browse button is clicked

2> to get the functionality of the OpenFileDialogue control in VB.net of displaying only the file types specified by the filter property
eg.
OFD.Filter = "Text Files (*.txt; *.doc)|*.txt; *.doc|" + "Image files (*.bmp; *.gif; *.jpg; *.png)|*.bmp;*.gif;*.jpg;*.png|" + _
"All files (*.*)|*.*"


a.shows only .txt & .doc files when "Text Files" is selected in the File Type field
b.shows only .bmp, .gif, .jpg & .png files when "Image Files" is selected in the File Type field
c.shows all files when "All files" is selected

Can we do these things with the file field control in asp.net 1.1?


There's no defeat untill you stop trying....

peace95 October 30th, 2006 11:30 AM

daffodils:
My question to you is: Why is the ID-property and the name-property the same on your INPUT statement (="fn")? I suggest changing one of them to be unique.

Hope this helps.


All times are GMT -4. The time now is 09:09 AM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.