I want to upload files to server by giving file list in text file like
c:\file1.ext
c:\file2.ext
is this possible without using UploadFile control or form method in asp.net c# ?
Only if the server and client are on the same LAN or VPN, you can think of using this:
String source = #"c:\file1.ext";
String desctrination = #"\\SERVER\TRANSFERDATA\file1.ext";
File.Move(source, desctrination);
or
File.Copy(source, desctrination);
It's impossible to grab files from client's machine without using fileupload controls.
Http protocol doesn't allow to do that.
You could have file transfer on client's machine and it could send you those files, or you could have web service for uploading files, but you can't directly grab files from client's machine
If you want a quick and easy answer no, but there is no such thing as impossible!! you can do one of those options:
Creating WCF service and let client install it in his PC.
Using ActiveX.
in video link Below you can see that ASP.net application accessing point of sale device that plug to client PC, now if that application can access device, you can access the C drive..
Connect to POS device throw asp.net
Related
I'm creating a window service which will monitor the folder and upload files to server if any new files created.
Here I'll have only web URL with virtual directory , created via IIS. Is it possible to upload a file to server only with URL.
I've tried using webclient to upload, its throwing error
The remote server returned an error: (405) Method Not Allowed.
This was my sample code tried:
using (WebClient client = new WebClient())
{
client.UploadFile(targetURL, phscialpath);
}
Gave required permissions, to both IIS and physical path folder.
As far as I know, it's impossible to directly upload a file to the server directly.
Normally, we have two ways to upload the file to the IIS server. On way is hosting a application on the IIS and the application has the codes to save the file to the server.By using this way, you need have the enough knowledge to build the application by using ASP.NET , PHP or else. This will be a complex application.
The second way is using ftp. We will create a FTP application on the IIS server and then you could use FTP to transfer the file to the server. By using this way, you could directly save the file to the speicific folder by using url.
Details about how to build a IIS FTP server, you could refer to below aritlce:
https://learn.microsoft.com/en-us/iis/publish/using-the-ftp-service/creating-a-new-ftp-site-in-iis-7
More details about how to transfer the file to the ftp by codes, you could refer to this answer.
What is the best way to get files from client folder (a folder that the client will choose the path) and upload to server?
Thanks.
You can't.
For privacy reasons, code from web sites running in a browser context is not allowed to enumerate files or directories on the client machine and send that information to a server. Imagine what would happen if it could!
You could possibly get around this limitation with some more complicated solution that includes a client side install (e.g. an ActiveX control) but this is simply not possible with ASP.NET alone.
As the title says, I need to access files from a server remotely. After doing this, I need to show the files in a windows file/folder Dialog style.
I need this using Remoting.
It's not that simple since I have some problems:
I don't have access to the client UNC sharing;
I don't know where the \server\xpto is physically pointed;
The service at the server must use the physical path.
Also, the sharing must be enabled (not always is), I'd need to prompt username/password and I'd have the network path, not the physical.
So, it's like accessing a server in a data center using the client app.
I guess you can do it by a web application. Create a page on the server which can reach the local files on the server and displays a list of them on a grid. You can add some commands on the files as well. The page you created would act as a middleware to reflect the operations you want on the files.
hope it helps.
Visual Studio 2008
I have a xml file I want to send to a ubuntu server.
Before I was using the following to save on the current machine in the application folder. However, the customer has changed and now wants to store it on a remote network ubuntu server.
dt.WriteXml(System.IO.Path.Combine(System.Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData), "Config.xml"));
What is the best way to send files across the network? Is it possible to send files from a windows machine to a ubuntu server machine?
Many thanks for any advice,
The easiest solution is probably to use a samba daemon and plain old file copying. If your customer wants to use the Ubuntu server as a file server, they may have already set this up.
Another option is to run an FTP daemon on the server and use the WebClient class to upload the file to it. You can use the WebClient.UploadFile method to upload a file to the server or WebClient.UploadString to upload the string directly, using the FTP STOR command.
The easiest thing to do is probably to SCP it onto the remote machine.
Run a samba daemon on the ubuntu server and you can use shared folders (SMB) to transfer the file.
I need to get physical path in silverlight. I'm using WCF service, I created one folder called 'Myfolder'. So I need to get the path of myfolder Please help me.
Silverlight doesn't allow direct access to the file system. However you can take advantage of Isolated Storage to read and write files on the client side. Here is a tutorial for that.
If you need access to a folder in the web application that is hosting your Silverlight app, use your service. Once you are in your OperationContract method, or even if you leverage the WebClient to make an AJAX style request, you can access the file system on the server but remember that is a different machine than your Silverilght client with the exception of when you do development (or browse your app on the server).