- Control in a dynamic or static page
- Creating an Upload control
- Control characteristics
- Multi-file Upload control in AWP
- Maximum size of files to upload
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.
- These controls propose the generation in HTML 5 mode in version 22 (new feature of version 22, 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:
- In the page editor, on the "Creation" tab, in the "Usual controls" group, expand "Button".
- In the list that is opened, select the "File upload" control type.
- 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 "Receiving the uploaded files" 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 Events associated with an Upload control
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).
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
The Upload control cannot be used in an Ajax looper.
Maximum size of files to upload
, 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:
- Select the following registry key:
- On a 64-bit computer: HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\PC SOFT\WEBDEV\28.0
- On a 32-bit computer: HKEY_LOCAL_MACHINE\SOFTWARE\PC SOFT\WEBDEV\28.0
- 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:
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.
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