Click here to Skip to main content
15,888,521 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
hi all

i need to search files like, pdf,doc,jpg etc in a server where my site is hosted. i am now developing a website that is to be hosted and used in intranet.

my actual problem is i don't know how to represent the server through program , that is don't know how to set the path to upload the files to server.

can any on help me with code for the above..

thanks in advance.....
Posted
Updated 5-Dec-11 22:56pm
v4

1 solution

C#
string filename = Path.GetFileName(FileUploadControl.FileName);
           FileUploadControl.SaveAs(Server.MapPath("~/") + filename);
           StatusLabel.Text = "Upload status: File uploaded!";

With Server.MapPath you can get the path of the application.Futher you can place your uploaded fiels in any folder in your application


Check this link For file Searching in perticuler directory >>>

Using DirectoryInfo class to search for files in a directory on both single pattern and multiple patterns[^]
 
Share this answer
 
v2
Comments
Ragi Gopi 6-Dec-11 0:16am    
and for searching????
Anuj Banka 6-Dec-11 0:36am    
You Can do If(File.Exist(Server.MapPath("~/") + filename))

I have given a link in my solution pls check that also.If its fulfill your requirement then Give me 5.Mark as ans :) :)
Ragi Gopi 6-Dec-11 0:48am    
thanks dear....
may i work on this ....
Anuj Banka 6-Dec-11 1:00am    
Yes just play with this code. And don't forgot to mark as answer :) :)
Ragi Gopi 6-Dec-11 3:52am    
oooppps.....its not working ,,but your answer seems to be correct...
can u plz guide me to a full example..

thanks in advance

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900