Solved

Select a file and get the file path without uploading

Posted on 2014-11-05
1
184 Views
Last Modified: 2014-11-06
Hi,

I would like to be able to just browse and choose a file from my computer and get the file and path into that selection. I don't want to upload it, I just want the user to be able to choose the file from his/her system so that I can get hold of the path and file in code behind. In that way I can move the file internally on the network.

I can't use an upload control for security reasons (it will only give me the file name) so I winder if anyone has some insight on another way to do this.

Thanks for help!

Peter
0
Comment
Question by:peternordberg
1 Comment
 
LVL 33

Accepted Solution

by:
ste5an earned 500 total points
ID: 40425744
As it's ASP.NET, you want that the user browses for a file in the browser. Then sends the path to your server. Now you(?) - maybe you mean the ASP.NET application - should move the file?

If your answers are yes, then my answer is: this is not possible.

For two reasons:

The path transmitted to your server is the path as seen by the client. Even worse, it may be a local mapped path. Imho there is no way to use a Windows API function like WNetGetUniversalName (advapi32) in the browser. And you cannot rely on normal netlogon scripts to get the mappings right, this is only possible in a highly restriced and controlled environment.

The user has under most circumstances different permissions than your ASP pool thread. So you cannot access the files from your application.

Especially the permission problem should make you rethink what you're trying to do. Maybe you can give us a little bit more context.
0

Featured Post

Resolve Critical IT Incidents Fast

If your data, services or processes become compromised, your organization can suffer damage in just minutes and how fast you communicate during a major IT incident is everything. Learn how to immediately identify incidents & best practices to resolve them quickly and effectively.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

More often than not, we developers are confronted with a need: a need to make some kind of magic happen via code. Whether it is for a client, for the boss, or for our own personal projects, the need must be satisfied. Most of the time, the Framework…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
Finds all prime numbers in a range requested and places them in a public primes() array. I've demostrated a template size of 30 (2 * 3 * 5) but larger templates can be built such 210  (2 * 3 * 5 * 7) or 2310  (2 * 3 * 5 * 7 * 11). The larger templa…

820 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question