Tuto WEBDEV 25

120 Part 3: Intranet site with data 5.  Let’s take a look at this WLanguage code: • PageToFile is used to initialize the items with the values of linked controls, for the current record. This function is equivalent to the following code lines: Product.Reference = EDT_Reference Product.Caption = EDT_Caption Product.Description = EDT_Description ... Our page is using less than 10 controls and the benefit is already there; think of the pages containing a lot more controls: a single code line performs all assignments! • HModify is used to update the file data for the current record. • PageDisplay is used to display another page. In our case, "PAGE_List_of_products" is redisplayed. 6. Save the modifications ( or Ctrl + S). 7. Close the code window. Managing the product image In the Product data file, an item is used store the image associated with the product. The Image control is already found in our page, allowing us to see the image, but we are going to give the Web user the ability to change the image associated with the product. To do so, we are going to allow the Web user to upload an image file found on his computer and to associate it with the item found in the data file. We will be using an Upload control. Remark The upload consists in copying a file from the client computer to the server. On the contrary, the download consists in copying a file from the server to the client computer. Remark WEBDEV proposes to manage the file upload via two specific controls: • an Upload control used to upload a single file, • an Upload control used to upload several files. In this example, the user will upload a single file at a time, therefore we will be using the single-file Upload control. ▶ To create the Upload control: 1. On the "Creation" pane, in the "Usual controls" group, expand "Button". The list of preset buttons is displayed. 2. Select "Uploading files". 3. Click the position where the control must be created in the page (below the Image control for example).

RkJQdWJsaXNoZXIy NDQ0OA==