Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 1 Monat, 3 Wochen
Letzter Beitrag:
vor 1 Monat, 2 Wochen
Beteiligte Autoren:
Gianni Spano, Fabrice Harari, Markus K., kingdr, Allard, Paulo Oliveira, cardcoder

[WB] Loading external files - Part 2

Startbeitrag von Gianni Spano am 16.10.2017 11:58

Hello to all

I'm developing a webdev project where i need to load some files from the user pc and save them in a blog field in a database.

As suggested by Mike Allison, i found in the button list, the UPLOAD button that enable me to open a dialog and select a file.
My needed:
After the file selection, i need to know the full pathname of the selected file and, unfortunately, the filename doesn't contains the full path (i imagine for security reasons).
I will explain why i need the full pathname:
The user will select one or multiple files at a time and i will store their pathname in a grid, then when it push the SAVE button (to save all the info about the record) it will read the grid items and extract the pathname to "re-read" the file contents and store it in the longblob field as a binary format.

Is there someone that can suggest me how to proceed??

Thanks in advance


Hi Gianni,

it looks like you are misunderstanding how upload works and why.

When you upload a file, you send/copy it physically from the browser to the server. For security reasons, the server NEVER has access to the browser side hard drive.

So storing the full BROWSER path in a table then later GETTING/READING it from the server is completely impossible.

What you can do is use the new html 5 upload control where you can store the file information in a looper after selection/drag and drop, on the BROWSER SIDE, then when clicking on the "upload" button, all files are uploaded on the server.

But again, the server doesn't need the full path from the browser side, as it's a place it can NOT access.

Best regards

von Fabrice Harari - am 16.10.2017 13:27
Hi Fabrice

Yes, i already know about the limitation on server side.
In fact i don't want to upload and store the local pathname of a file directly to the server, but i would store it in a table in the browser and further the full path will be read to retrieve the file contents and then store it in a longblob field on a database.
My operation is NOT to load the file server side, but only locally.

I hope this will be possible, otherwise i will try a workaround..if exist!!

Thanks again

von Gianni Spano - am 16.10.2017 15:50
Just check the content of the upload control, as far as i remember you will find the full name of the file in the PC and the name of the temp file created in the server.

Be carefull with the upload control webdev creates one temp file for each atempt to upload of a file and in some situations don't delete it, after a while it will reuse the same temp file name and if the file you are uploanding is smaller than the one with the same temp name it will merge the content of both files.

The temporary files are created inside the webdev in the tmpupload directory

von Paulo Oliveira - am 16.10.2017 16:24
Hi Paulo

Thanks for the suggestions.


von Gianni Spano - am 17.10.2017 09:24
Hi Gianni,

I do not really understand what you are trying to do, and you seem to think that it's possible to access the local drive from a browser the same way than from a windev application.

Well it's NOT, as the browser is supposed to be isolated from the local machine for security reasons.

Now directly in JS and html 5, there is now an api available, if that is really what you need to do:

But I'm not sure you'll be able to do everything you need

Best regards

von Fabrice Harari - am 17.10.2017 11:48
Hi Fabrice

It's a bit hard to me to explain better my needed in english :) and i admit my poor knowledge of web programming.

But i will try to explain the steps i would like to reproduce:

First, i'm developing a web application for our Neurology doctors and they told me that they need to load on their database a series of documents (radiographies (images), pdf, docs) and other useful files the patient give them .
They load these files (normally) in their pc and they want to "load" these files in a database, so other doctors that may visit a patient can see all these attachments stored in the database.
To do that, i thought to put a table with some columns and in one of them i store the full pathname of the local file they want store in the db, then once he terminates the input of the informations, do a save of the records.
Each document (attachments) are saved in the db reading its pathname from table using "hlinkmemo" etc etc to store the file contents in a longblob field in the db.
That's all!!

Thanks again.

P.S. the application must run in an Intranet, so the reason because i'm using Webdev.

von Gianni Spano - am 17.10.2017 13:20
Hi Gianni,

Maybe take a look at the documentation or an example of the upload stuff of webdev. Intranet or internet makes no difference.

To me this is just standard upload control stuff. You donot need the client path name for sure !


von Allard - am 19.10.2017 08:57
Hi Gianni,

If you want to upload the file from the workstation (pdf / doc etc), why not -

1. use the upload file procedure to put the file into a folder on the server
2. perform procedure to add it into the database as blog
3. delete file from folder

This would -
make it available to everybody as required.
Keep the integrity of the information because the file is deleted from the folder.

Hope this helps,


von cardcoder - am 19.10.2017 09:12
If your application runs in an intranet, why you dont use windev instead webdev?

von Markus K. - am 19.10.2017 10:27
Hi Markus

Yes. It could be a possibility, but we are working on an Intranet and i should install the application in each computer in the Hospital.. Not a good solution!!
We have an Intranet site where i publish a link with the connection to the server where the application runs. It is more easy and it runs.

In the meantime, i found a solution to solve my needed: when the user access to the site the first time, i create a temp folder with his name, like "\Temp_Admin" and after few tests it is totally transparent to the users and it is running fine. Then i store the pathname in a global variable like "gsTempPath" and it is available from any page loaded.



von Gianni Spano - am 20.10.2017 11:54

Try this:

Info(fDataDir )

to see where files uploaded then use HLinkmemo to start storing files.

I used to do this:

// For each file sent
FOR i = 1 _TO_ UPL_Upload..Occurrence
// Copies the file into the directory of data
UploadCopyFile(UPL_Upload, fDataDir + ["\"] + "Upload", "", i)

ie where someone else is doing upload and won't get crossed.

ps. watch out file permssion for upload in file server.



von kingdr - am 20.10.2017 14:18
Hi King



von Gianni Spano - am 21.10.2017 16:05
Hi again

>>Yes. It could be a possibility, but we are working on an Intranet and i should install the application in each computer in the Hospital.. Not a good solution!!

No you don't

You install it on a server, in a shared directory, and you just setup a LINK on each computer, ONCE.

Then when you update the exe, everybody just starts the new exe, without any change on any machine.

Best regards

von Fabrice Harari - am 22.10.2017 11:49
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.