AYUDA EN LÍNEA
 WINDEVWEBDEV Y WINDEV MOBILE

Este contenido se ha traducido automáticamente.  Haga clic aquí  para ver la versión en inglés.
Ayuda / WLanguage / Funciones WLanguage / Funciones específicas de la Web / Funciones de carga de archivos (Upload)
  • Overview
  • Available elements
  • Upload via an Upload edit control
  • Uploading a file in a page
  • Displaying the image to upload
  • Remark
  • Maximum size of files to upload
WINDEV
WindowsLinuxUniversal Windows 10 AppJavaReportes y ConsultasCódigo de Usuario (UMC)
WEBDEV
WindowsLinuxPHPWEBDEV - Código Navegador
WINDEV Mobile
AndroidWidget Android iPhone/iPadIOS WidgetApple WatchMac CatalystUniversal Windows 10 App
Otros
Procedimientos almacenados
Overview
Uploading consists in saving a file located on the user's computer to the Web server. The file found on the user's computer is "uploaded" to the server: it is loaded and saved on the server.
All types of files can be uploaded.
Examples for using the file upload:
  • Phone Book site: when a new contact is added to the phone book, the user can select the contact photo on their computer. In order for the photo to be displayed independently of the Web user, the photo is "uploaded" to the server.
  • Site for document management: each Web user can make different types of documents available to the other Web users: text, ... These documents are selected on the computer of the Web user and "uploaded" to the server in order to be made available to all the Web users.
Available elements
The following elements are used to manage the file upload:
  • an UPLOAD edit control: In the browser, a "BROWSE" button is automatically added to the right of the Upload edit control. This button allows the Web user to select the file to "upload".
    A gray button is displayed in the editor. This button cannot be modified (style, caption, ...).
    Caution: this edit control is a specific control: no Value properties should be used on this control. To get the name of the uploaded file, use UploadFileName. The upload mode with this type of control is presented in Upload via an edit control.
  • an Upload control (single-file or multi-file): Several controls are automatically inserted into the editor as well as the WLanguage code required to use them immediately. This control can be generated for HTML5-based execution. For more details, see Upload control.
  • two server functions of WLanguage:
    UploadCopyFileSaves an "uploaded" file on the server. During this backup, the saved file can be renamed on the server.
    UploadFileNameReturns the name of an "uploaded" file (initial file name or file name saved on server)
  • several WLanguage browser functions are used to handle the Upload control:
    UploadCurrentFileIndica el archivo cargado actualmente a través de control Upload.
    UploadCurrentFileSizeDevuelve el tamaño total (en bytes) del archivo cargado actualmente a través de un control Upload.
    UploadCurrentFileSizeSizeSentDevuelve el tamaño (en bytes) ya enviado para el archivo actualmente cargado a través de un control Upload.
    UploadDeleteElimina un archivo de la lista de archivos a cargar: el archivo no se cargará en el servidor.
    UploadDeleteAllBorra la lista de archivos a cargar: no se cargará ningún archivo en el servidor.
    UploadSizeDevuelve el tamaño total (en bytes) del archivo cargado actualmente a través de un control Upload.
    UploadSizeSizeSentDevuelve el tamaño total (en bytes) de los archivos ya enviados por el upload actual a través de un control Upload.
    UploadStartInicia el envío de los archivos seleccionados a una control Upload.
Upload via an Upload edit control

Uploading a file in a page

To upload a file in a page:
  1. Create an UPLOAD edit control (the type of the control is defined in the "General" tab of the control). This control allows the Web user to select the file to "upload".
  2. Add a Button control or a Link control. This control will be used to upload the file on the server. This Button or Link control must be of type "Submit" ("Button action" in the "General" tab of the control description window). When the page is validated using this control, the file is uploaded to a temporary directory on the server. Therefore, this file cannot be viewed by the other Web users.
  3. In the server click code of this Button or Link control, you can use:
    • UploadFileName (UploadFileName(<Upload control>, False)) to check whether the file was uploaded and to retrieve its name. Indeed, during the upload, the file is renamed with a temporary file name.
    • UploadCopyFile to copy and rename the uploaded file on the server. This file can be copied into the resource directory (_WEB) or into a directory accessible via an alias.
    • HLinkMemo to load the image in a memo item of an HFSQL file.
Mistake not to make: The direct use of the file name on the browser station (reading the value by the Property Value in server or browser code) in file management functions is an error not to be made.. Indeed, this operation operates in development mode (the server and the browser are found on the same computer) but NOT in deployment. In this case, the server and the browser are different computers. The server does not see the browser files. To get the names of the files to use, use UploadFileName.

Displaying the image to upload

To display the image previously selected with an Upload edit control (EDT_UploadControl) in an Image control (IMG_ImageControl):
  1. In the code of the page, add the optional "OnMouseMove" browser code.
  2. Enter the following code lines in this code:
    IF SAI_ChampUpLoad <> "" THEN
    IF IMG_ChampImage <> SAI_ChampUpload THEN
    IMG_ChampImage = SAI_ChampUpload
    END
    END
Remark: This operation may not operate depending on the browser used and on the security level.
Remark

Maximum size of files to upload

Por Default , el tamaño de los archivos para cargar no está limitado en el motor WEBDEV. Este tamaño puede ser limitado:
  • por el servidor web utilizado. Para más detalles, consulte la documentación sobre el servidor web utilizado.
  • por WEBDEV Application Server.
El archivo no se cargará si su tamaño excede el tamaño límite.
Para modificar el tamaño máximo de los archivos a cargar en el servidor de aplicaciones WEBDEV , se debe modificar el registro en el servidor. Esta modificación se puede realizar para todas las aplicaciones WEBDEV.
Para modificar el tamaño de los archivos cargados para todas las aplicaciones WEBDEV:
  1. Seleccione la siguiente clave de registro:
    • En un equipo de 64 bits: HKEY_LOCAL_MACHINE\SOFTWARE\WOW6432Node\PC SOFT\WEBDEV\29.0
    • En una computadora de 32 bits: HKEY_LOCAL_MACHINE\SOFTWARE\PC SOFT\WEBDEV\29.0
  2. Añadir la clave MAX_UPLOAD. El valor de esta clave corresponde al tamaño máximo de los archivos a cargar (en KB).
For a large transfer (several hundreds of MB), we recommend that you use the FTP protocol instead of the upload. You have the ability to perform an FTP transfer from a WEBDEV page, via a Java applet created with WINDEV.
PHP Límites en PHP:
  • El tamaño de los archivos cargados está limitado por las directivas "upload_max_filesize" y "Post_max_size" del archivo de configuración de PHP (archivo php.ini).
  • La carga de archivos debe estar permitida por el servidor PHP. Para ello, la directiva "file_uploads" debe estar set a "on" en el fichero de configuración de PHP (fichero php.ini).
  • La directiva upload_tmp_dir del fichero de configuración debe ser especificada hacia un directorio con derechos de lectura/escritura.
Versión mínima requerida
  • Versión 9
Comentarios
Haga clic en [Agregar] para publicar un comentario

Última modificación: 12/01/2024

Señalar un error o enviar una sugerencia | Ayuda local