Uploading user files with a web app
Issue: 10.3 (March/April 2012)
Author: Paul Lefebvre
Article Description: No description available.
Article Length (in bytes): 2,835
Starting Page Number: 73
RBD Number: 10312
project 10312.zip Updated: Thursday, March 1, 2012 at 11:11 AM
Related Link(s): None
Known Limitations: None
Excerpt of article text...
Real Studio Web Edition has a built in control that makes it easy for your users to upload files to your web application. This month we will take a look at the WebFileUploader control class.
To get started, create a new Web project and drag a FileUploader onto the default page (changing its name to PictureUploader).
FileUploader has built-in functionality to allow the user to select files to upload. The user clicks the"+" button to add a file to the list. The "-" button can be used to remove files that have been previously added to the list. Try running the project and playing with the buttons so you can see how they work.
Since we only want the user to upload pictures, we can restrict this using the FileAdded event:
If Filename.Right(4) <> ".jpg" And filename.Right(4) <> ".png" Then
MsgBox("Please select pictures.")
Run the project again and try to add a non-picture file.
At this point nothing has been uploaded to the server yet. The filenames only exist in the list. To actually upload the files to the server, we need to call the Upload method.
...End of Excerpt. Please purchase the magazine to read the full article.
Article copyrighted by REALbasic Developer magazine. All rights reserved.