Diese Seite mit anderen teilen ...

Informationen zum Thema:
Forum:
WinDev Forum
Beiträge im Thema:
15
Erster Beitrag:
vor 7 Monaten
Letzter Beitrag:
vor 7 Monaten
Beteiligte Autoren:
Aad Gouka, Piet van Zanten, Paulo Oliveira, Stefan Bentvelsen

SOLVED WB17 - fFileExist().

Startbeitrag von Aad Gouka am 14.01.2017 19:41

Hi all,

I'm struggling with fFileExist() in WebDev. I have a button which checks if a file exist in the map where all the .awl files are. I've tried everything but it won't work. Anybody using fFileExist() with succes ?

Best regards,

Aad

Antworten:

Re: WB17 - fFileExist().

did you try something like this:

if fFileExist((completedir(fExeDir())+"your_file.awl") then
...
else
...
end

von Paulo Oliveira - am 16.01.2017 17:12

Re: WB17 - fFileExist().

Hi Paolo,

if fFileExist((completedir(fExeDir())+"your_file.awl") then
info("Found")
else
info("Not found")
end

If the file exists or not, no message. Can Info("") be used like in WinDev ?

von Aad Gouka - am 16.01.2017 17:31

Re: WB17 - fFileExist().

My knwlege of webdev is very limited but if it's only to test try something like this:

if fFileExist((completedir(fExeDir())+"your_file.awl") then
info("Found")
return
else
info("Not found")
return
end

von Paulo Oliveira - am 16.01.2017 18:01

Re: WB17 - fFileExist().

The problem is, in my example we have a true or false, so either way the infobox need to show up, like in WinDev.

My WebDeb knowledge is also limited, but it's not clear to me why Info("') can be used, but doesn't work, unless it works in another way then in Windev, like most things do. According to the Help, I'm not doing it wrong.

Best regards,

Aad

von Aad Gouka - am 16.01.2017 18:08

Re: WB17 - fFileExist().

Hi Aad,

I've also limited knowledge of WebDev, but can it be something with rights on that map on the server?

von Stefan Bentvelsen - am 16.01.2017 19:38

Re: WB17 - fFileExist().

Hi Stefan,

This is the code I use to download a file from the server. Before the download
starts, I want to check of the file exists. The downloas is working fine so I don't
think it's a right matter.

Bestand = gsUploadMap + "\"+ BASEDOC.URL

IF fFileExist((CompleteDir(fExeDir())+Bestand)) THEN
Info("Bestand gevonden")
ELSE
Info("Bestand niet gevonden")
END

FileDisplay(gsUploadMap + "\"+ BASEDOC.URL,"application/unknown",BASEDOC.URL)


von Aad Gouka - am 16.01.2017 19:47

Re: WB17 - fFileExist().

Hi Aad,

I'm not sure, but my gut feeling tells me it's not a good idea to store anything in the exedir.
Can't you use a subdirectory of the _WEB folder instead?

Regards,
Piet

von Piet van Zanten - am 16.01.2017 21:28

Re: WB17 - fFileExist().

Hi Piet,

Of course your right, but I think that won't solve my problem :)
You work a lot with Webdev. What do you use to generate screen messages ??

Best regards,

Aad

von Aad Gouka - am 16.01.2017 22:04

Re: WB17 - fFileExist().

Hi Aad,

I use PageDisplayDialog in dynamic pages.
Or just Info(), YesNo() or Error().

To download a generated report I use
IF fFileExist(sTempPath+sFile) THEN
FileDisplay(sTempPath+sFile,sFileType,sFile)
fDelete(sTempPath+sFile)
END

Best regards,
Piet

von Piet van Zanten - am 16.01.2017 23:29

Re: WB17 - fFileExist().

Thanks Piet,

In a way it's the same as I do. The problem is that Info() doens't work.
There is no message on the screen either way, do the user gets an error when the file
doesn't exist and is thrown out and needs to login again.

Best regards,

Aad

von Aad Gouka - am 17.01.2017 09:49

Re: WB17 - fFileExist().

did you try with this?

Bestand = gsUploadMap + "\"+ BASEDOC.URL

IF not fFileExist((CompleteDir(fExeDir())+Bestand)) THEN
Info("file not found")
RETURN
END

von Paulo Oliveira - am 17.01.2017 10:17

Re: WB17 - fFileExist().

Hi Paulo,

Yes I did, no luck.

von Aad Gouka - am 17.01.2017 10:27

Re: WB17 - fFileExist().

Hi Aad,

You could try removing the FileDisplay from the code like:
if not fFileExist(sFile) then
Info(...)
else
PageDisplayDialog(PAGE_Download,sFile)
end

Then in the OK button of Page_Download do the FileDisplay.

Best regards,
Piet

von Piet van Zanten - am 17.01.2017 10:36

SOLVED WB17 - fFileExist().

Hi Piet,

That's the right track:

Bestand = gsUploadMap + "\"+ BASEDOC.URL

IF fFileExist(Bestand) THEN
FileDisplay(gsUploadMap + "\"+ BASEDOC.URL,"application/unknown",BASEDOC.URL)
ELSE
Info("The file does not exist on the harddrive.")
END


This works. So in some construction Info() does not work.

Thanks for al the input I received.

Best regards,

Aad

von Aad Gouka - am 17.01.2017 11:15
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.