ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

This content has been translated automatically.  Click here  to view the French version.
Help / WLanguage / WLanguage functions / Web-specific functions / Upload functions
  • Maximum size of files to upload
  • Pre-launched sessions
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Returns the name of a file "uploaded" by the Web user. This file must have been uploaded:
  • via a single-file or multi-file Upload field. For more details, see Upload control.
  • via an "Upload" Edit control (kept for compatibility).
Ajax This function is only available in AJAX for new single-file or multi-file Uploads.
Example
// Champ Upload multifichier
// Evenement Réception des fichiers uploadés
// Pour chaque fichier
FOR i = 1 _TO_ UPL_Upload.Occurrence
	// Récupère le nom du fichier sur le poste de l'utilisateur
	sNomFichier is string = UploadFileName(UPL_Upload, False,i)
	// Uploade le fichier dans le répertoire _WEB
	sNomFichierCopié is string = UploadCopyFile(UPL_Upload, fDataDir(), "",i)
	// Vérifie que le fichier a bien été copié
	IF fFileExist(fDataDir() + "\" + sNomFichierCopié) THEN
		gsFichierUploadé = fDataDir() + "\" + sNomFichierCopié
	END
END
// Champ de saisie de type Upload
FichierSource, FichierDest are strings
// SAI_Fichier est le nom du champ de saisie contenant le nom complet du fichier à uploader
// Recherche du nom du fichier uploadé sur le serveur
FichierSource = UploadFileName(SAI_Fichier)
// Si FichierSource existe, on le copie dans le répertoire des documents sur le serveur
IF FichierSource <> "" THEN
	// Recherche du nom du fichier uploadé sur le client
	FichierDest = UploadFileName(SAI_Fichier, False)
	FichierDest = "c:\documents\" + fExtractPath(FichierDest, fFile + fExtension)
	// Copie du fichier
	fCopyFile(FichierSource, FichierDest)
END
Syntax
<Result> = UploadFileName(<Upload control> [, <File location> [, <File index>]])
<Result>: Character string
Name of uploaded file.
<Upload control>: Control name
Name of control used for upload. This control can be:
  • a single-file or multi-file Upload control field.
  • an "Upload" Edit control. This control contains the name and path of the file that will be sent to the server.
<File location>: Optional boolean
Location of file whose name you want to get:
  • True (default): Name of the uploaded file on server.
  • False: Name of the file to be uploaded (on the user's computer).
<File index>: Optional integer
Index of the file whose name is to be retrieved. This parameter is only used for an upload performed with the multi-file Upload control. By default, this index is 1.
Remarks

Maximum size of files to upload

By default, the size of files to upload is not limited in the WEBDEV engine. This size can be limited by the WEBDEV Application Server.
The file will not be uploaded if its size exceeds the limit size.
To modify the maximum size of the files to upload in the WEBDEV Application Server, the registry must be modified on the server:
  1. To change the size of uploaded files for all WEBDEV 2025 applications, select the following key:
    • 32-bit: HKEY_LOCAL_MACHINE\SOFTWARE\PC SOFT\WEBDEV\30.0
    • 64-bit: HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\PC SOFT\WEBDEV\30.0
  2. Add the MAX_UPLOAD string. The value of this string will be the maximum size of files to upload (in KB).
PHP Limits in PHP:
  • The size of the uploaded files is limited by the "upload_max_filesize" directive in the configuration file of PHP (php.ini file).
  • The file upload must be allowed by the PHP server. To do so, the "file_uploads" directive must be set to "on" in the configuration file of PHP (php.ini file).
  • The upload_tmp_dir directive of the configuration file must be specified toward a directory with read/write rights.

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.
Related Examples:
Uploading or Downloading a file Unit examples (WEBDEV): Uploading or Downloading a file
[ + ] This example explains how to upload (copy to the server) or download (download from the server) a file and it allows you to:
- Copy a file from the browser computer to the server
- Download a file found on the server
- Download a file found on the server via a link
- Download a file found on the server by requesting its opening
Component: wd300page.dll
Minimum version required
  • Version 9
Comments
Click [Add] to post a comment

Last update: 03/27/2025

Send a report | Local help