|
|
|
|
- Maximum size of files to upload
- Name of uploaded file
- Pre-launched sessions
<Upload>.CopyFile (Function) In french: <Upload>.CopieFichier Saves on the server a file "uploaded" by the Web user. This upload may have been performed: - via an "Upload" edit control.
- via a single-file or multi-file Upload control.
During this backup, the copied file can be renamed on the server.
// Get the file sent by the client refFile is string refFile = EDT_File.CopyFile("C:\Documents", "REF_3304") // If the source file is: "/User/Foo.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 UPL_Upload.CopyFile(fDataDir(), "", i) END
Syntax
<Result> = <Upload control>.CopyFile(<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 Upload control used. This control can correspond to: - an "Upload" edit control. This control contains the name and path of the file that will be sent to the server.
Remark: it is possible to use the attribute of a Looper control (Value property for the attribute). - a single-file or multi-file Upload control.
<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.
<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 identical to the file name on the computer of the Web user.
- the file name only (without the extension), the file extension on the server will be identical to the file extension on the computer of the Web user.
- 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 files to upload in WEBDEV Application Server, the registry must be modified on the server: - To modify the size of the uploaded files for all the WEBDEV 28 applications, select the following key: HKEY_LOCAL_MACHINE\SOFTWARE\PC SOFT\WEBDEV\28.0 on a 32-bit computer and HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\PC SOFT\WEBDEV\28.0 on a 64-bit computer.
- Add the MAX_UPLOAD string. The value of this string will be the maximum size of files to upload (in KB).
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 "Initialize project after connecting to the site" event.
Related Examples:
|
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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|