ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / WLanguage / WLanguage functions / Web-specific functions / Upload functions
  • Maximum size of files to upload
  • Name of uploaded file
  • 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
Saves a file "uploaded" by the user to the server. This file must have been uploaded:
  • via a single-file or multi-file Upload control. For more details, see Upload control.
  • via an "Upload" Edit control (kept for compatibility).
During this backup, the copied file can be renamed on the server.
Ajax This function is only available in AJAX for single-file or multi-file Upload controls.
// Retrieve the file uploaded by the user (Upload control)
refFile is string
refFile = UploadCopyFile(EDT_File, "C:\Documents", "REF_3304")
// If the source file is: "/User/AFile.jpg".
// refFile = "REF_3304.jpg" and the file was copied into "C:\documents\REF_3304.jpg"
// Upload performed from a multi-file Upload control
// For each file sent
FOR I = 1 _TO_ UPL_Upload.Count
	// Copies the file into the data directory
	UploadCopyFile(UPL_Upload, fDataDir(), "",  I)
END
Syntax
<Result> = UploadCopyFile(<Upload control> , <Path on server> , <File name> [, <File index>])
<Result>: Character string
  • Name (name + extension) of the file uploaded on the server (does not contain the file path),
  • Empty string ("") if an error occurred.
<Upload control>: Control name
Name of the control used. This control can be:
  • a single-file or multi-file Upload control.
  • an "Upload" Edit control. This control contains the name and path of the file that will be sent to the server.
    Note: You can use the attribute of a Looper control (Value property for the attribute).
<Path on server>: Character string
Path of server directory where the file will be copied. This path can correspond to the path returned by fDataDir. This path can also correspond to fCurrentDir although the hosts rarely grant the rights to write in this directory.
Linux This parameter is ignored. The file is uploaded in the "/tmp" directory of Linux server. This directory cannot be modified.
<File name>: Character string
Name (name and extension) of the file uploaded on the server. The file is overwritten if it already exists.
If this parameter corresponds to:
  • an empty string (""), the file name on the server will be the same as on the user's computer.
  • the file name only (without the extension), the file extension on the server will the same as on the user's computer.
  • the file name and the file extension, this name and this extension will be used when copying the file to the server.
<File index>: Optional integer
Index of the file to save on the server. 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.

Name of uploaded file

UploadFileName is used to find out the name of an "uploaded" file.

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
Video UploadCopyFile
https://youtu.be/lR70LvqkVsQ

https://windevdesenvolvimento.blogspot.com/2019/03/dicas-2031-webdev-aula-31.html

sARQUIVO is string=""
sARQUIVO = UploadCopyFile(EDT_Upload,fDataDir()+"\upload","")

amarildo
02 Mar. 2019

Last update: 09/06/2024

Send a report | Local help