ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Web-specific functions / Miscellaneous WEBDEV functions
  • Choosing the target of the file
  • Retrieving the parameters passed to an Active WEBDEV Page
  • Downloading large files
  • Pre-launched sessions
  • Web services
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Others
Stored procedures
Displays a file in the browser of Web user. Allows you to display documents (that are not accessible to the web server) in the user's browser: files hidden for security reasons, binary memos, ...
WEBDEV - Server code You can also give the ability to the Web user to download the file. For more details, see Downloading files. Once FileDisplay has been run, the site execution site continues but the request is ignored (PageRefresh would be ignored for example).
WEBDEV - Browser code The files displayed can be:
  • any page, accessible on Internet or on a local network.
  • an Active WEBDEV Page by specifying the value of the parameters expected by the page. These parameters can be retrieved:
    • in the "Global declarations" event of the page.
    • with the PageParameter function.
WEBDEV - Server codeWindowsLinux
// Displays a dialog box allowing the Web user
// to download the NOTES.TXT file on his computer. 
FileDisplay(CompleteDir(fWebDir()) + "NOTES.TXT", ...
		"application/unknown", "Notes.TXT")
WEBDEV - Server codeWindowsPHP
// Displays a dialog box allowing the Web user
// to download the NOTES.TXT file on his computer. 
// NOTES.TXT and .PHP are found in the same directory
FileDisplay("NOTES.TXT", "application/unknown", "Notes.TXT")
WEBDEV - Server codeWindowsLinux
// Displays a file found in a protected directory
// This file is displayed only if the user is allowed to
// Authorize is a boolean used to manage the user rights
IF Authorize = True THEN
	FileDisplay("c:\date\protected\map.gif", "image/gif")
ELSE
	PageDisplay(PAGE_Error)
END
WEBDEV - Server codeWindows
// -- Click code of Submit button
// Display the "MyFile.PDF" file 
// found in the "<ProjectName>_WEB" directory
sFile is string
sFile = fWebDir() + "/MyFile.pdf"
FileDisplay(sFile, "application/pdf")
WEBDEV - Browser codeWindows
// Active WEBDEV Page: Checks whether a delivery number was entered 
// (the control is not empty and the number size is equal to 18)
IF NoSpace(EDT_DELIVERYNUM) = "" OR ...
	Length(NoSpace(EDT_DELIVERYNUM)) = 18 THEN
	// Resumes the input of the number
	FileDisplay("webdev_del_number.awp?P1=1&P2=" + LANGUAGECODE)
END
FileDisplay("webdev_del_history.awp?P1=" + EDT_DELIVERYNUM +  ...
	"&P2=" + LANGUAGECODE)
Syntax
WEBDEV - Server codePHP

Use in WEBDEV Server Hide the details

FileDisplay(<File name> [, <MIME type> [, <Name of file for backup>]])
<File name>: Character string
Full path of file to display in the browser of Web user. The file must be accessible on the server (rights, existence of the file, ...).
<MIME type>: Optional Ansi character string
  • Name of MIME type to use. The MIME type is used to indicate to the browser the type of file that must be handled. Hundreds of types are defined in the MIMI communication standard (available on Internet). The most common values recognized by most browsers are:
    • "text/html": HTML page (*.htm, *.html) (by default)
    • "text/plain": text file (*.txt)
    • "application/pdf": document in PDF format (*.pdf)
    • "image/gif": image in GIF format (*.gif)
    • "image/jpeg": image in JPEG format (*.jpg, *.jpeg)
    • "video/mpeg": video in MPEG format (*.mpg, *.mpeg)
    • "application/unknown": used to display a dialog box proposing to download the file onto the computer of Web user.
    • "application/msword": used to display a Word file.
    • "application/vnd.ms-excel": used to display an Excel file.
  • MIME type corresponding to one of the following constants:
    mimeTypeXMLApplicationXML content.
    mimeTypeBinaryBinary content (byte stream).
    mimeTypeDOCWord file (*.doc)
    mimeTypeDOCXWord file (*.docx)
    mimeTypeGIFGIF image (*.gif)
    mimeTypeHTMLHTML page (*.htm, *.html)
    mimeTypeJPEGJPEG image (*.jpg, *.jpeg)
    mimeTypeJSONJSON content.
    mimeTypePDFPDF document (*.pdf)
    mimeTypePNGJPEG image (*.png)
    mimeTypeSOAPSOAP content in XML format.
    mimeTypeTextText (*.txt)
    mimeTypeXMLTextXML text
    mimeTypeXLSExcel file (*.xls)
    mimeTypeXLSXExcel file (*.xlsx)
    mimeTypeZIPZIP file (*.zip)
<Name of file for backup>: Optional character string
Name of file to save if the Web user wants to download the file onto his computer. If this parameter is specified, the file download is automatically proposed.
WEBDEV - Browser code

Use in WEBDEV Browser Hide the details

FileDisplay(<Page address> [, <Target>] , <Name of the window> [, <Options> [, <Width> [, <Height> [, <Horizontal position> [, <Vertical position> [, <JavaScript parameters>]]]]]])
<Page address>: Character string
URL address of the page that must be displayed in the new browser window. If this parameter corresponds to an empty string (""), a blank page is opened ("about:blank").
If the page to display is an Active WEBDEV Page with parameters, name of the AWP file followed by the parameters to pass to the Active WEBDEV Page. To be directly retrieved in the "Global declarations" event of the page, the parameters must be named P1, P2, .., P256.
<Target>: Optional character string or constant
Name of target frame. <Target> can also take the following values:
CurrentBrowserthe target is the current browser.
This parameter can also correspond to the "_top" string (compatibility with WEBDEV 1.5).
CurrentFramethe target is the current frame (default value).
This parameter can also correspond to the "_self" string (compatibility with WEBDEV 1.5).
NewBrowserthe target is a new browser (a new browser window is opened). The following parameters of FileDisplay are used to configure this new window.
This parameter can also correspond to the "_blank" string (compatibility with WEBDEV 1.5).
ParentFramethe target is the container of the current page (parent frameset, parent browser).
This parameter can also correspond to the "_parent" string (compatibility with WEBDEV 1.5).
<Name of the window>: Optional character string
Name of the new browser window. This parameter allows you to redisplay a page in a browser window with the same name (if several browser windows are opened on the computer of the Web user).
<Options>: Optional Integer constant (or combination of constants)
Parameters of the new browser window:
ONFull
(Default value)
The window of the new browser will include an address bar and scrollbars (equivalent to the combination of all the previous constants)
ONLinkThe link bar will be displayed
ONLocationThe address bar will be displayed
ONMenuBarThe menu bar will be displayed
ONResizableThe new browser window will be resizable
ONSatusBarThe status bar will be displayed
ONScrollbarThe scrollbars will be displayed
ONSimpleThe window of the new browser will be a simple window (no combination of constants).
ONToolbarThe toolbar will be displayed
<Width>: Optional integer
Width (in pixels) of the new browser window. Can correspond to the Default constant.
<Height>: Optional integer
Height in pixels of the new browser window. Can correspond to the Default constant.
<Horizontal position>: Optional integer
Horizontal position (in pixels) of the new browser window in relation to the upper-left corner of the main screen. Can correspond to the Default constant.
<Vertical position>: Optional integer
Vertical position in pixels of the new browser window in relation to the upper-left corner of the screen. Can correspond to the Default constant.
<JavaScript parameters>: Optional character string
Other JavaScript parameters that must be used when opening a new browser if <Target> is set to "_blank".
Remarks
WEBDEV - Browser codeWindows

Choosing the target of the file

To choose the target of the file, we recommend that you use the <Target> parameter of FileDisplay rather than ChangeTarget. Indeed, in this case, the corresponding JavaScript code is smaller and the size of your pages is optimized.
WEBDEV - Browser codeWindows

Retrieving the parameters passed to an Active WEBDEV Page

Several methods can be used to retrieve the parameters passed to an Active WEBDEV Page:
  1. Retrieving parameters in the "Global declarations" event of the page.
  2. Retrieving the parameters with PageParameter.

Downloading large files

Downloading files with FileDisplay can take longer than downloading files directly via an http link.
When using FileDisplay, the WEBDEV engine:
  1. Opens the file to download.
  2. Transfers the file to the Web server while asking to send the file to the Web user.
When using an http link, the browser of the Web user directly finds the file to download.
For the large files, we recommend that you use an http link. In this case, the path and name of the file to be downloaded can be configured with the URL property.

Pre-launched sessions

If your project uses pre-launched sessions, this function must not be used in the project initialization event. This function must be used in the "Initialization in pre-launched session mode" event.

Web services

This function can be used in web services.
Business / UI classification: UI Code
Component: wd300dllexe.dll
Minimum version required
  • Version 9
Comments
Click [Add] to post a comment

Last update: 07/02/2024

Send a report | Local help