ONLINE HELP
 WINDEVWEBDEV AND WINDEV MOBILE

Help / Developing an application or website / Controls, windows and pages / Controls: Available types / Upload control
  • Overview
  • Control in a dynamic or static page
  • Creating an Upload control
  • Control characteristics
  • Remarks
  • Multi-file Upload control in AWP
  • Miscellaneous
  • Maximum size of files to upload
WINDEV
WindowsLinuxJavaReports and QueriesUser code (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Browser code
WINDEV Mobile
AndroidAndroid Widget iPhone/iPadIOS WidgetApple WatchMac Catalyst
Others
Stored procedures
Overview

Control in a dynamic or static page

The Upload control is used to upload files on the Web server.
WEBDEV proposes an advanced Upload control that can be used immediately. It includes several controls (that can be deleted if necessary):
  • Looper used to manage the files to upload. This looper is used to specify the file characteristics, to display a progress bar during the upload and to propose a button used to delete the file from the list if necessary.
  • Caption indicating where the files to upload will be dropped.
  • "Add" button used to add the files.
  • "Send" button to start the file upload.
This control can be used in singlefile mode or in multifile mode.
The Upload control directly manages the Drag and Drop of files from the explorer (if the browser supports the HTML 5 standard). For more details, see Handling Upload controls programmatically.
Remarks:
  • These controls support HTML 5 (see Control characteristics).
  • The Upload edit control is kept for backward compatibility. For more details, see Uploading files.
  • The preset control proposed for the upload is an asynchronous control: You still can continue to use the current site without being locked by the upload.

Creating an Upload control

To create an Upload control:
  1. In the page editor, on the "Creation" tab, in the "Usual controls" group, expand "Button".
  2. In the list that opens, select the "File upload" control type.
  3. Click where you want to create the control in the page. The control appears in the page.
To display the control characteristics, select "Description" in the context menu of the Upload control ("Send" or "Add").
The WLanguage code for managing uploads can be found in the events associated with the Upload control. This code can be modified according to your requirements.
Important: The "Receive files uploaded" event must be modified before deploying the site. A code sample is supplied in comment. This code can for example:
  • copy the uploaded files into a specific site directory,
  • insert the uploaded files into a binary memo, ...
For more details, see Upload control events.

Control characteristics

Several specific options are available in the "Details" and "UI" tabs of the Upload control description (accessible via the description of the "Add" button):
  • Multi-file selection ("UI" tab): allows the multi-selection in the control. If this option is not checked, only the upload of a single file will be possible.
  • Generate an image for the button, with embedded caption (for compatibility) ("Details" tab): generates an image with the aspect of the button. The button caption is embedded in the image. The aspect of the button will be the same even if different browsers are used.
  • Management of Drag/Drop ("UI" tab): Used to allow "Drag and Drop" from the Windows explorer. For more details, see Managing Drag and Drop of files to an Upload control (HTML5).
Remarks

Multi-file Upload control in AWP

A multi-file Upload control in AWP implicitly creates an AWP context on disk. This type of control is not compatible with the management of contexts via cookies. For more details on AWP contexts, see Managing AWP contexts.

Miscellaneous

The Upload control cannot be used in an Ajax looper.

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 Web server used. For more details, see the documentation about the Web server used.
  • by WEBDEV Application Server.
The file will not be uploaded if its size exceeds the limit size.
To modify the maximum size of files to upload in WEBDEV Application Server, the registry must be modified on the server. This modification can be performed for all the WEBDEV applications.
To modify the size of the uploaded files for all the WEBDEV applications:
  1. Select the following registry key:
    • On a 64-bit computer: HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\PC SOFT\WEBDEV\30.0
    • On a 32-bit computer: HKEY_LOCAL_MACHINE\SOFTWARE\PC SOFT\WEBDEV\30.0
  2. Add the MAX_UPLOAD key. The value of this key corresponds to the maximum size of files to upload (in KB).
Remark: A limit linked to the Web server (IIS, Apache, ...) can also exist. For example, for IIS, you have the ability to edit the XML "%windir%\system32\inetsrv\config\applicationhost.config" file and to create or modify the "maxAllowedContentLength" attribute of "requestLimits" tag by specifying the size in bytes.
Example to set the limit to 50 MB in IIS:
<system.webServer>
          <security>
.....
<requestFiltering>
.....
<requestLimits maxAllowedContentLength="52428800"/>
</requestFiltering>
....
PHP Limits in PHP:
  • The size of the uploaded files is limited by the "upload_max_filesize" and "post_max_size" directives 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.
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
Minimum version required
  • Version 15
Comments
Click [Add] to post a comment

Last update: 07/05/2024

Send a report | Local help