Navigate to file, rename and move in mvc net core app
-
Hi I’m a newbie, 50 with a bad memory, so pls be toleraterant;-) I want my web app to allow a user, within a view, to navigate to a file of a document they scanned with a pc, then give it a guid and copy it to a new served location. How would I go about this? Would it be done in js? How about the guids? Would the view model carry some ready for use by the view/js? Or would you do it another way?
-
Hi I’m a newbie, 50 with a bad memory, so pls be toleraterant;-) I want my web app to allow a user, within a view, to navigate to a file of a document they scanned with a pc, then give it a guid and copy it to a new served location. How would I go about this? Would it be done in js? How about the guids? Would the view model carry some ready for use by the view/js? Or would you do it another way?
You definitely can't do it in C# - that runs on the Server, not the Client, so any file system interaction involves the server file system, not the client scanned data. Having said that, you can't do it in JS either, as the browser has no access to client files systems either for security reasons! What you would have to do is have the user upload the file to the server, then your C# renames the file, saves it locally, and if necessary sends the GUID back to the client so he can manually rename the file.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
-
You definitely can't do it in C# - that runs on the Server, not the Client, so any file system interaction involves the server file system, not the client scanned data. Having said that, you can't do it in JS either, as the browser has no access to client files systems either for security reasons! What you would have to do is have the user upload the file to the server, then your C# renames the file, saves it locally, and if necessary sends the GUID back to the client so he can manually rename the file.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
-
Ok, the pc is the server (IIS), but there are several pcs in the office all of which navigate the IIS on one of them. So, i want the user to navigate to the file they just scaned onto a network location (perhaps this should be a network attached NAS)
I'm not sure you can do that either: you can link to a remote file and open it in the browser just with an href:
[Click here](file:\192.168.0.11\Images\MyImage.jpg)
and provided the user has permissions set for the NAS it'll open the image in the browser. (My NASes are SBM1, which Windows 10 doesn't like any more, so I have to use IP addresses instead of the server name). But that won't open an external application for security reasons - the user would have to download the file and then open it themselves.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
-
I'm not sure you can do that either: you can link to a remote file and open it in the browser just with an href:
[Click here](file:\192.168.0.11\Images\MyImage.jpg)
and provided the user has permissions set for the NAS it'll open the image in the browser. (My NASes are SBM1, which Windows 10 doesn't like any more, so I have to use IP addresses instead of the server name). But that won't open an external application for security reasons - the user would have to download the file and then open it themselves.
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
That won't work; if the web page is served via
http:
orhttps:
, it can't link to afile:
URI. The user would have to right-click the link, copy the URL, open a new tab, and paste the URL into it.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
-
That won't work; if the web page is served via
http:
orhttps:
, it can't link to afile:
URI. The user would have to right-click the link, copy the URL, open a new tab, and paste the URL into it.
"These people looked deep within my soul and assigned me a number based on the order in which I joined." - Homer
Cock! You're right, of course - it works fine as local HTML, but won't work when served from IIS ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
-
Cock! You're right, of course - it works fine as local HTML, but won't work when served from IIS ...
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony "Common sense is so rare these days, it should be classified as a super power" - Random T-shirt AntiTwitter: @DalekDave is now a follower!
Maybe I need to explain better what I envisioned. User finds location of the pdf they just scanned in to a local network accessible location using a file finding dialogue. The path to that pdf is posted back to the controller. The post method then finds the file, copies it and then saves it with a guid in another more secure location.
-
Maybe I need to explain better what I envisioned. User finds location of the pdf they just scanned in to a local network accessible location using a file finding dialogue. The path to that pdf is posted back to the controller. The post method then finds the file, copies it and then saves it with a guid in another more secure location.
Lmm Cams wrote:
The post method then finds the file
Just use a FileUpload control instead. Let the user pick what file to upload.