How to let your user upload a file to the web server
To let your users upload a file to the web server, all you need is an Alpha Five web page with some code. No web component is needed.
So in the Web Projects Control Panel select New, select A5W Page, and press the OK button. Then go to the source tab and under the <title></title> section (about the fourth line down), enter the following code.
Incidentally, if you place some words between the <title></title> you will give your Web Page a title that will display at the very top of the browser. I added Upload Page, so my title code looks like <title>Upload Page</title> and my browser widow displays
Figure 11. Title of Web Browser
Anyway about the fourth line down enter the following code:
The reference to c:\In_Folder\ is a folder on my system. You can name the folder anything you want. You will also need to make sure the folder exists before this is run, or an error will be returned.
Now if you look at the WYSIWYG window you will not see anything. This code just tells Alpha Five what to do if there is a file in the next piece of code we are about to enter.
So go down to the <body> section and enter the following code:
<form action=" <%a5 ? request.script_name %> " method ="post" enctype="multipart/form-data">
<input type="file" name="FileToUpload"> <input type="submit" name="cmd" value="Upload File"></form></p>
Basically your code window should look like this:
Figure 12. Source Code for Uploading files
Be sure to save your page, and then publish the page. When your page is published, the page will look like this:
Figure 13 Upload Page in Web Browser
Go ahead try it. First press the Browse button, and find a file on your system. Select that file and it will fill in the empty box to the left of the Browse Button. Then press the Upload File button. When the empty box becomes empty again, the file has been uploaded. So go to the folder where the file was uploaded to and see if the file is there. It should be! If you get an error, it will probably be due to the fact that you may not have created a folder named In_Folder. So create that folder and try again.
Back To Tips, Guidelines, Articles