local network get file path but not upload file - c#

I know when uploading files for security reasons the browser will not get directory of file when using a file upload control. But what I am looking for is for the local network user to select a file in a network drive and capture the path and file name but not upload that file. this is just to store the file they select in a table. Is there a way of doing this? some sort of work around? the only thing I've thought of is putting a textbox and having the user copy/paste the file path but is there an easier method? again not uploading the file just capturing what file and location the local network user wants to use.

It can't be done using the File upload control (html input element). You have to use a plugin like (possibly) Flash or a custom ActiveX control.
What you are looking for is not possible using standard web technologies (html, css, js).

Related

Most reliable way to validate an uploaded file type in C# to prevent malicious, even if renamed to accepted file extension

I read some articles about uploading files, people can upload malicious programs (php, exe,...) to attack the server and the website, what is the reliable way to protect and avoid any danger for the website and our server. In my website, I need to allow my registered users to upload files like
.doc, .txt, .pdf extension files.
So any idea to validate to uploaded file is in acceptable file format (even it is renamed)
Ideas in C# will appreciated.

Can C# open a the container folder of a specific file by its path?

In my project, I have a fileupload control for user to upload their document and I want to provide a link to user to open their files.
steps:
after user upload a file, my web will create a link for it
when user click on that link, the container folder of that file will open.
For example, a file which its path is C:\Users\John\Downloads\jpg\a.jpg uploaded to the fileupload control. when user click on the link of that file, a folder C:\Users\John\Downloads\jpg will be opened.
To get the file path:
string filePath = FileUpload1.PostedFile.FileName; // file name with path.
So, how can I open a folder in client PC by C#?
For security reasons, browsers do not expose the local filesystem to the Javascript sandbox. What you're asking is not possible with Javascript or any other common browser technology that does not require a client install (like Flash or ActiveX). You definitely cannot get it in c# which runs on the server and has no knowledge of the client's filesystem.

Trouble with uploaded files in ASP.NET

I know how I can upload a file (i.e. PDF file) in ASP.NET. How can I do some operation on this file after it had been uploaded?
For example, I need to correct the wrong words, or another application is for some plagiarism system.

Options for uploading entire folder contents

Trying to figure out the best way to upload the entire contents of a folder in an HTML5 / .NET MVC-4 project. It looks like only Google Chrome supports the HTML5 drag and drop file upload functionality. Is there another plugin that I can use to allow users to upload the entire contents of a folder?

How to download a file to a specific folder?

I want to download a file to a specific folder. I'm using WebClient.DownloadFile, but what I would like is to let the user select where this file would be saved, not just download it into any folder.
How can I do this?
The folder that the user would download the file to would depend on their browser, and system settings.
All you can do is provide the file to download, and it would be up to them (and their browser) to select a local folder (on their system).
If you want to control that process, you would have to use an embedded plugin like Java, Silverlight, Flash, etc.
If you are using Windows Forms, you can use the SaveFileDialog class to allow the users to pick a file name, and then pass that name to the second parameter of WebClient.DownloadFile.

Categories

Resources