Uploading Files To Your Webpage In Whizbase

Have you ever wanted to upload your files to your hosting, or have you ever want to make a simple images gallery and let the visitors upload their pictures.

In this tutorial I will show you how simple is to write a script for uploading your files online (with no need for complicated web scripts like ASP or PHP) by using WhizBase. I have been a WhizBase developer for 6 months now, I also have been a PHP developer for 7 years.

Simple HTML uploading form

If you want to upload images you will need a form, it is made in pure HTML, a page where you click on “Browse” and select the file you want to upload. Fortunately HTML provides us with the elements, we do not need to write scripts to list files on our computer.

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:

Upload an Image

Select file (*.jpg;*.gif – max. 100KB):

Let take a look in some important elements in this code, first the Form tag, without it our code will not work, the form tag must contain information like action (where to send the file data), method (there is two general methods – get and post; when sending files use post) and enctype(there is a lot of encoding types, multipart/form-data is used for uploading files).







Also we need to use the input of type file, that input is the one which let us browse our computer files. Last is the submit input, it is the button which people will click to send or upload the file.

Save this file as index.htm and put it in a folder so you do not loose it.

The butter of the work

Now we want to make the server-side file, it is the script which takes the file, save it on the hosting server.

1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
17:
18:

[FormFields]
WB_AllowMultipart=T

[Upload]
WB_Disallow=![jpg,gif,png,bmp]
WB_UploadDir=/
WB_Overwrite=T
WB_MaxFSize=102400


For more information about WhizBase please visit WhizBase site or contact me on NurAzije [at] Gmail [dot] com.NurAzije is a PHP and WhizBase programmer, who at the time of article publication is working in partnership with WhizBase on several projects.
Article Source