Upload

=Upload=

The **Upload** statement adds a widget to a web page that allows a user to select a file to upload to the server. The syntax is as follows:

UPLOAD promptExpr$; path$ //- Insert an upload widget into the display output. The uploaded file's name is in path$.//

The **Upload** widget consists of a textbox, a "Browse" button and an "Upload" button. The **promptExpr$** is a text label displayed next to the textbox. Use text that instructs the user that he is to select a file to upload. It looks like this when it is first displayed:



The user presses the "Browse" button to select a file to upload. Once he has chosen a file, the name of the file appears in the textbox:



The user then presses the "Upload" button and when the file has been uploaded successfully, the widget is removed from the web page and the uploaded file's name is displayed.



Here is a single-line program that adds an **Upload** widget to a web page:

code format="vbnet" upload "Select a file to upload."; file$ code

Here is a program that allows the user to upload an image file. The file is then loaded and displayed:

code format="vbnet" upload "Select an image file."; image$ if image$ = "" then end

loadgraphic #pic, image$ render #pic code