Upload a file from the client to the server "programmatically" using the file name or "programmatically" assign the file name UploadFile Control

My question is in two parts

1) I want to assign a file name to FileUpload Control and then save it, but the problem is that it is read-only

FileUpload1.FileName="ClientMachine\\Image1.jpeg"; FileUpload.SaveAs(ServerMachine\\Image1.jpeg); 

Is there another way?

OR

2) I have the full path to a single image on the client machine. I want to download this image.

I searched on google, but most of the question does this with ajax, javascript, multipart-form. I do not have such knowledge. Can I do this exclusively with C #.

+5
source share
1 answer

what you need to do is access the file on the client computer programmatically without any explicit user action. it is impossible for obvious reasons, for example, asp.net code runs on the server, and your file is on the client . There are obvious security reasons why you cannot do this.

You can create some kind of active x or silverlight plug in and run it in elevated mode, but again, this is not recommended.

here is a similar question

+2
source

Source: https://habr.com/ru/post/1240990/


All Articles