Post by mackrackit on May 16, 2009 0:11:05 GMT -5
I got some of the parts for this from the forum, thanks to all who share...
The Upload program allows you to make sub directories in the public directory and upload to any directory in the public directory. I know, not a big deal.
The Download program allows you to download any file in the public directory or one of the sub directories.
Maybe someone will find these useful.
Upload
Download
The Upload program allows you to make sub directories in the public directory and upload to any directory in the public directory. I know, not a big deal.
The Download program allows you to download any file in the public directory or one of the sub directories.
Maybe someone will find these useful.
Upload
'File Upload
'Written for Linux, "/" will need to be changed to"\"
'for Windows with the exception of HTML statements
global workingDIR$
global htmlDIR$
global XworkingDIR$
global XhtmlDIR$
workingDIR$ = "/public"
'#####################################
[START]
cls
html "<body leftmargin='0' topmargin='0' style='color: rgb(255, 255, 255); background-color:
rgb(0, 0, 0);' alink='#ff9900' link='#ff9900' marginheight='0' marginwidth='0' vlink='#ff9900'>"
print:print
lvl = 1
button #reset, " HOME ", [reset]
'button #upLev, " Back One Level ", [upLev]'Only good for one level
button #newDIR, " Make New Directory ", [newDIR]
button #LoadUp, " Up Load File ", [LoadUp]
print
'print "DefaultDir ";DefaultDir$
print "Working Directory = ";workingDIR$
'print "htmlDIR ";htmlDIR$
'print "XworkingDIR ";XworkingDIR$
'print "XhtmlDIR ";XhtmlDIR$
print " "
'#######################################
fN = 0
files #fs, DefaultDir$ + "/public" + "/*"
print " MAIN DIRECTORIES"
for i = 1 to #fs rowcount()
#fs nextfile$()
name$ = #fs name$()
d = #fs isdir()
id$ = lvl;"|";name$
dirid$ = name$
if d = 1 then
'print " "
fN = fN + 1
'###############################
button #dirid,dirid$, [Mdir]
#dirid setkey(dirid$)
'###############################
end if
if fN = 9 then
print
fN = 0
end if
next
'#####################################
print
'#######################################
fN = 0
files #fs, DefaultDir$ + workingDIR$ + "/*"
print " SUB DIRECTORIES"
for i = 1 to #fs rowcount()
#fs nextfile$()
name$ = #fs name$()
d = #fs isdir()
id$ = lvl;"|";name$
dirid$ = name$
if d = 1 then
'print " "
fN = fN + 1
'###############################
button #dirid,dirid$, [Ldir]
#dirid setkey(dirid$)
'###############################
end if
if fN = 9 then
print
fN = 0
end if
next
wait
end
[Ldir]
XworkingDIR$ = workingDIR$
XhtmlDIR$ = htmlDIR$
workingDIR$ = workingDIR$ + "/" + EventKey$
htmlDIR$ = htmlDIR$ +"/"+ EventKey$
goto [START]
wait
[Mdir]
workingDIR$ = "/public" + "/" + EventKey$
htmlDIR$ = "/"+ EventKey$
goto [START]
wait
[reset]
workingDIR$ = "/public"
htmlDIR$ = ""
goto [START]
wait
[upLev]
workingDIR$ = XworkingDIR$
htmlDIR$ = XhtmlDIR$
goto [START]
wait
[LoadUp]
upload "Select a file to upload."; file$
if file$ = "" then end
open file$ for binary as #f
filedata$ = input$(#f, LOF(#f))
close #f
open "public" + htmlDIR$ + "/" + file$ for binary as #g
print #g, filedata$;
close #g
print "File "+file$+ " is now in "+ htmlDIR$
kill file$
wait
[newDIR]
cls
button #reset, " HOME ", [reset]
print
print "Do you want to make a new sub-directory"
print "in ";workingDIR$
'#######################################
button #reset, " NO ", [reset]
button #yesDIR, " YES ", [xDIR]
wait
[xDIR]
print
print "Enter name of new sub-directory"
input dVar$
a=mkdir("public"+htmlDIR$+"/"+dVar$)
wait
Download
'File Download
'Written for Linux, "/" will need to be changed to"\"
'for Windows with the exception of HTML statements
global workingDIR$
global htmlDIR$
global XworkingDIR$
global XhtmlDIR$
workingDIR$ = "/public"
'#####################################
[START]
cls
html "<body leftmargin='0' topmargin='0' style='color: rgb(255, 255, 255); background-color:
rgb(0, 0, 0);' alink='#ff9900' link='#ff9900' marginheight='0' marginwidth='0' vlink='#ff9900'>"
print:print
lvl = 1
button #reset, " HOME ", [reset]
button #upLev, " Back One Level ", [upLev]
print "Just 1, not 2."
'print "DefaultDir ";DefaultDir$
print "Working Directory = ";workingDIR$
'print "htmlDIR ";htmlDIR$
'print "XworkingDIR ";XworkingDIR$
'print "XhtmlDIR ";XhtmlDIR$
print " "
'#######################################
fN = 0
files #fs, DefaultDir$ + "/public" + "/*"
print " MAIN DIRECTORIES"
for i = 1 to #fs rowcount()
#fs nextfile$()
name$ = #fs name$()
d = #fs isdir()
id$ = lvl;"|";name$
dirid$ = name$
if d = 1 then
'print " "
fN = fN + 1
'###############################
button #dirid,dirid$, [Mdir]
#dirid setkey(dirid$)
'###############################
end if
if fN = 9 then
print
fN = 0
end if
next
'#####################################
print
fN = 0
'#######################################
files #fs, DefaultDir$ + workingDIR$ + "/*"
print " SUB DIRECTORIES"
for i = 1 to #fs rowcount()
#fs nextfile$()
name$ = #fs name$()
d = #fs isdir()
id$ = lvl;"|";name$
dirid$ = name$
if d = 1 then
'print " "
fN = fN + 1
'###############################
button #dirid,dirid$, [Ldir]
#dirid setkey(dirid$)
'###############################
end if
if fN = 9 then
print
fN = 0
end if
next
'#######################
'FILES
print " ":print " "
print "FILES"
files #fs, DefaultDir$ + workingDIR$ + "/*"
for i = 1 to #fs rowcount()
#fs nextfile$()
name$ = #fs name$()
d = #fs isdir()
id$ = lvl;"|";name$
dirid$ = name$
if d = 0 then
print " "
html "<a href='";htmlDIR$;"/";name$;"'target=_blank>";name$;"</a>"
end if
next
wait
end
[Ldir]
XworkingDIR$ = workingDIR$
XhtmlDIR$ = htmlDIR$
workingDIR$ = workingDIR$ + "/" + EventKey$
htmlDIR$ = htmlDIR$ +"/"+ EventKey$
goto [START]
wait
[Mdir]
'XworkingDIR$ = workingDIR$
'XhtmlDIR$ = htmlDIR$
workingDIR$ = "/public" + "/" + EventKey$
htmlDIR$ = "/"+ EventKey$
goto [START]
wait
[reset]
workingDIR$ = "/public"
htmlDIR$ = ""
goto [START]
wait
[upLev]
workingDIR$ = XworkingDIR$
htmlDIR$ = XhtmlDIR$
goto [START]
wait