Copy the files from desktop and Paste in webapplication - c#

I need to Copy the files from desktop and Paste it in Web application created by asp.net with c#.
If the user copy any files from esktop, and paste the file in my webapplication output(i,e i run the application, the user enter using their login and paste some files.
then my application get the file and save it.
so, how can i get the file while user paste?
This is urgent.
Thanks and regards,
Pooja

So I assume you allow user to access your application folder via network sharing, then you met need to monitor that folder so after new file added you can get them, please check this: http://www.techrepublic.com/article/use-the-net-filesystemwatcher-object-to-monitor-directory-changes-in-c/6165137
and hope it helps.
But why not you implement some upload function?

Related

How to host a local file for external http access from a C# Windows application

I've a .Net/C# Windows application which can create text/pdf files. My requirement is to make these files accessible via http links for another internal application inside my organization. The internal application only accepts http links (ftp and others are not supported).
I know this can be done manually by placing these files in an IIS server. I would like to know whether there is any easy way to do this programmatically? Once the file is created locally in my application, I should have a http link to access the file.
I'm not sure if I understand your need correctly. You can point it out when anything wrong.
Assuming that the application create pdf files in a folder named PDFile. On IIS, you can add a site and set it physical path to PDFile folder. If you enable Directory Browsing, you can see all files when enter the url of this site in browser like this:
When you want to access these file from an external machine, just enter the url http://serverIP:port/PDF file name for example http://xxx.xxx.xxx.xxx:80/mycustomefile.pdf. No need to set anything programmatically.

Folder selection in MVC web application c#

I am working on one MVC web application project, which require one field called folder selection just like FolderBrowserDialog in windows application.
Help me to find that FolderBrowserDialog for web application. Is there any solution for folder selection in MVC??
Short answer is no. You can use a to select a file, but modern browsers will not send a path for security reasons (and your browser does not have access to paths on the server)
There is no such control (except using ActiveX Control or Java Applets), so don't waste your time to look for it and you can not get any folder path(on the client machine) with JavaScript due to security reasons.
Why don't you just allow the user to download the file and user will select the folder where he wants that file to be saved or else it will get saved in default folder of the browser.
Hope it helps, thanks.

Get path of downloaded path in asp.net application [duplicate]

how can we find the path of browser default downloads folder in c# / asp.net?
For example I can get the path of user desktop like :
Environment.GetFolderPath(Environment.SpecialFolder.Desktop)
Thanks..
You can't find that out in a web application. It's up to the user to decide which browser to use and how to configure it and where to save downloaded files by default and you have absolutely no way of interfering or even knowing his choices from a web application.
First of all looking at MSDN on Environment.SpecialFolder there is no download folder, and the reason is that this is different for every browser.
http://msdn.microsoft.com/en-us/library/system.environment.specialfolder.aspx
And there have nothing to do with asp.net, if you look it from the server side you just get a directory on nowhere, meaning that this have nothing to do with the web application that run under the pool.
What you can do
You can use the HttpRuntime.AppDomainAppPath and use it to know where your site lives, and there place a "download" directory and use this full path:
HttpRuntime.AppDomainAppPath + "download/"
for download/upload files.

IIS7: Unable to read CSV file

I am unble to read csv file when I use URl of the Website. But, it runs fine when I run using VS2010. I know it is permission issue: as I am new to server side I need some help. All other Webpages that don't deal with CSV file are running fine. I am using IIS7. Till now I have played with DCOM, WMI and have given access to everyone. There is no error Website is not able to open the file and read it.
Please let me know if you need additional info.
Make sure IUSR has read permissions for the directory that contains the csv file.
This is how it works: Click on the site name. Double click Authentication. Select ASPNET Impersonation.Click Select the user and enter your credentials similarly select the sever and follow above instruction for ASP.NET Impersonation. And it will work!!

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