'Demo of uploading file and moving it to a
'different folder called uploads.
'The new folder is created in the program.
'create error handler
on error goto [oops]
'attempt to create a new folder called uploads
a = mkdir("uploads")
if a then
'if nonzero result, directory was created
print "Created ""uploads"" directory."
'if result=0, directory already exists
print "Directory ""uploads"" already exists."
'add upload widget to page
upload "Select a file to upload."; file$
'filename is in file$, file is in root directory
'if no file uploaded, abort
if file$ = "" then end
'get contents of uploaded file into string variable
open file$ for binary as #f
filedata$ = input$(#f, LOF(#f))
'display a bit of filedata$ for test purposes
print "Filedata begins with ";left$(filedata$,20)
'open new file with same name in uploads folder
open "uploads\" + file$ for binary as #g
'write data to new file
print #g, filedata$;
print "File is now in uploads\" + file$
'delete uploaded file from root directory
print "The program has encountered an error."
print "Error number is ";Err;" and description is ";Err$
help on how to format text