Best way to give users access to uploaded document

new BookmarkLockedFalling
telbourn7
New Member
*

telbourn7 Avatar

Posts: 20Male

Post by telbourn7 on Jan 2, 2009 7:03:23 GMT -5

Good morning all.

I'm writing an application to allow users read-only access to each other's Word documents. I've written an upload routine but I'm stuck on how to allow users to view them. Can I create a URL from the directory and file name and present this as a link to the user ?

Any help greatly appreciated !

PS - It's taken me 6 days to get this far into my coding with Runbasic - I hadn't got this far in 6 months with PHP and MySQL !!!
Jerry Muelver
Administrator
*****

Jerry Muelver Avatar

Posts: 521

Psycho
Full Member
***

Psycho Avatar

Posts: 196

Post by Psycho on Jan 2, 2009 17:10:17 GMT -5

telbourn,

This isn't pretty, as I pieced it together from an application I have that performs a similar task, but it may be along the lines of what you are looking for.

Replace the "your folder name here" at the top of the program with the name of the folder inside your public directory that contains the word documents you want others to view.

 filepath$="public\your folder name here"
filepath2$="your folder name here" 'same as above without public\

call setCSS

[start]
titlebar "View Word Documents"
cls
print
html "<b>Please select a file from the list below. <b><br>"
print
html "<fieldset style =""width:280px; height:200px""> "
print
files #dir, filepath$+"\*.doc"
isEmpty = #dir hasanswer()
if isEmpty then
numberofFiles = #dir rowcount()
dim document$(numberofFiles)
div ListBx
for i = 1 to numberofFiles
dummy$ = #dir nextfile$()
fileName$ = #dir name$()
document$(i) = trim$(word$(fileName,1,ドル"."))
next i
gosub [sort]
for x = 1 to numberofFiles
fileName$=trim$(filepath2$+"\"+document$(x)+".doc")
displayname$=document$(x)+".doc"
html "<a href=""\"; fileName$ ; """ target='_new'>"; displayname$ ; " </a><br>"
next x
end div
end if
print
html "</fieldset>"
print
'button #continue, "Continue", [start]
print
button #quit, " Quit ", [quit]
wait

[quit]
dim document$(0) 'recover memory
cls
print "Goodbye"
end

[sort]
'Bubble sort routine to arrange files alphabetically
pass = 1
time2stop = 0
while (time2stop = 0)
noswaps = 1
for I = 1 to (numberofFiles - pass)
if document$(I) > document$(I + 1) then
tempvalue$ = document$(I)
document$(I) = document$(I + 1)
document$(I + 1) = tempvalue$
noswaps = 0
end if
next I
if noswaps = 1 then time2stop = 1
wend
return

sub setCSS
cssID #ListBx, "{
Width: 220px;
Height: 172px;
Overflow: Auto;
Border-Style: Inset;
Border-Size: 3px;
Border-Color: ##C1CDCD;
Margin-Left: 0px;
}"
end sub


HTH

John "Psycho" Siejkowski