Hi
concepet is i want upload pdf documents from folder Thay are selecting Drop category based on category in folder that pdf file s need to store in data base, after publish they client they login and in there System D drive or E drive they place pdf documents while selecteting category that related documents i need to update in server i am using this code but after pulishing this D drive path it will take server path only i dont want server path pdf files located in to client system so in that folder path files i want to get
string directoryPath = Server.MapPath("~/GpfPDF"); // Path to your folder
string dDrivePath = ConfigurationManager.AppSettings["gpfPdfPath"];
and string dDrivePath = @"D:\\GpfData\\";
string directoryPath= dDrivePath+ ddlcatgory.SelectedValue;
i am using this code also but it woo take server D Drive path
this gpf path i ention in D Drive one folder but it will take server D Drive path how can i get Client Local System D Drive path
Jayraj ChhayaPosted Oct 7, 2024, 12:01 PM
Accessing a client's local file system directly from a web application is not feasible due to security restrictions in web browsers. When you use
Server.MapPathor similar methods, they resolve paths on the server, not the client’s machine.To allow users to upload files from their local D drive, you should implement a file upload feature using an HTML file input element.
In your C# backend, you can handle the uploaded file like this:
This approach allows users to select files from their local drives, including the D drive, without directly accessing the file system paths.
Thulasiram pakalaPosted Oct 7, 2024, 11:09 AM
i Dont want to copy files from client system to server eg click onb browser select word file it will get file name that we ca convert and store in data base same like that hear browse button is not there category hey are selected and button they need to click they place in folder some pdf while click on button that pdf path need to covert and save in data base this pdf folder mutple file s are there Multiple categiry folder based on categorty based on number that record data need to pdf data need to updated in data base this local system file path locally its working fine but after publish in server this file path attaomitically it wiil server folder path i needd to take this path in local sytem path agd get that file names and need to store in data base
Vishal JoshiPosted Oct 7, 2024, 9:49 AM
Hello,
Reading the D or E Drive folder path directly from the C# code is impossible. C# code will only read paths where the application is running. so it will only read server paths.
To read the file from the client machine you can use FTP Protocol.
Check out the below article to get the file from the client machine.
https://medium.com/@jassinghmalhotra/get-list-of-files-and-folders-from-ftp-server-using-c-a9c89eea2905
Thanks