Click here to Skip to main content
14,428,904 members
Rate this:
Please Sign up or sign in to vote.
See more:
I am building a app and i would like each and every user on the lan using the app to be able to upload pdf documents into the database and be able to retrieve them

What I have tried:

The logic i used was to store the file path into the database and retrieve it using a web browser but now that i am running the app on a different machine, it cant find the file since the file path is something like C:\Users\shadow\Documents\....
Updated 28-Sep-19 2:42am
F-ES Sitecore 27-Sep-19 8:56am
Either store the documents in a folder on the server with the file path held in the database and stream the pdf file to the browser. Or store the actual PDF files themselves in the database as BLOBs and again stream the file to the user on request.

Lots of examples on line for doing both methods.
whatsapp myfriend 27-Sep-19 9:10am
Can you help me with the code for storing and reading the actual pdf as Blob. I am using Mysql Server
F-ES Sitecore 27-Sep-19 9:52am

You can do a search too if you want but you'll probably get less results. Just translate the c# examples into is not a good language for beginners as it's way harder to find examples.
whatsapp myfriend 27-Sep-19 10:15am
Richard Deeming 27-Sep-19 10:16am
I've removed my solution, since it was for ASP.NET, and you clarified that this is a desktop application.

As F-ES Sitecore said, you'll need to upload the files to a file share on a central server. While you might be able to refer to the files on the user's computer using a UNC path, it wouldn't work if that computer was turned off.
whatsapp myfriend 27-Sep-19 10:20am
I am having trouble retrieving the files since the file path stored on the database cannot be accessed from another computer
Richard Deeming 27-Sep-19 11:07am
Which is why you need to upload the files to a file share on a server.
whatsapp myfriend 27-Sep-19 11:32am
whatsapp myfriend 27-Sep-19 12:49pm
okay i have done it but i have a problem with the file server because there is a password on it and i dont know the command to use to include the username and password so that the app will not crash because right now its is crashing

1 solution

Rate this:
Please Sign up or sign in to vote.

Solution 2

You could install a (lightweight) webserver or WAMP server and put the .PDF files in the server directory. That way users can also use a browser with the link including the file name to download the .PDF file they want.
You don't need to write a web application in PHP or other messy language for that.
Here is an overview of lightweight webservers: cross-platform-lightweight-http-servers[^]
Here is an overview of webserver packages: free-and-open-source-web-server-solution-stack-packages[^]
There are even portable WAMP packages like: USBWebserver[^] ideal for testing purposes !

Another option would be to write your own webserver, see example here: An HTTP file server (130 lines of code) in VB.Net - Stack Overflow[^]
whatsapp myfriend 29-Sep-19 13:50pm
@RickZeeland I'm actually building a desktop application in
RickZeeland 29-Sep-19 14:09pm
See the update solution, added a suggestion for a file server in 130 lines of code :)
whatsapp myfriend 29-Sep-19 14:18pm
Is there a way i can send you a snapshot of what i am building so that you can see what i actually want to do. Also i would like to make a correction on what i posted earlier. its actually a network share not a file server
RickZeeland 29-Sep-19 14:21pm
Sorry, I'm not a VB.NET programmer, it would take me too much time !
whatsapp myfriend 29-Sep-19 14:24pm
okay no problem thank you for your efforts
RickZeeland 29-Sep-19 14:30pm
If you don't want to use a Client - Server construction with a separate Client and Server application, the simplest option would be to store the pdf files in the database.
whatsapp myfriend 29-Sep-19 14:35pm
i have not seen a working code on that because i would be happy if i can store them as Blob and read them back using the App

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100