ID:172988
 
yo, havn't been coding for a while, and im a lill bit lost..
how you code a verb so people can upload a file from their harddisk to the server....
so others can download it of it, ain't telling what's it for, ^lill part of a secret project im working on, DONT TRY TO GUESS IT, but please help :P
If you want to do that, you can make a global list holding all of the things in it.

Here's a little snippit of what I mean.

var/list/sharedfiles = list() // The global list which holds the files

mob/verb/add_file()
var/file = input("Add a file to the world","File") as null|file
if(isfile(file)) // just to check if it's a file
sharedfiles += file
src << "File \"[file]\" added!"
else
src << "Please select a real file."

mob/verb/download_file()
if(sharedfiles.len) // checking if there is anything in the list, otherwise, it's worthless checking it
var/file = input("Pick a file to download","File") in sharedfiles + "Cancel"
if(file=="Cancel") return
if(isfile(file)) // just to check if it is a real file
src << ftp(file)
src << "File \"[file]\" downloaded."
else
src << "There are no shared files added."


I hope I helped.

Unknown Person <<
In response to Unknown Person
thank you
In response to Unknown Person
Unknown Person wrote:
If you want to do that, you can make a global list holding all of the things in it.

Here's a little snippit of what I mean.

> var/list/sharedfiles = list() // The global list which holds the files
>
> mob/verb/add_file()
> var/file = input("Add a file to the world","File") as null|file
> if(isfile(file)) // just to check if it's a file
> sharedfiles += file
> src << "File \"[file]\" added!"
> else
> src << "Please select a real file."
>
> mob/verb/download_file()
> if(sharedfiles.len) // checking if there is anything in the list, otherwise, it's worthless checking it
> var/file = input("Pick a file to download","File") in sharedfiles + "Cancel"
> if(file=="Cancel") return
> if(isfile(file)) // just to check if it is a real file
> src << ftp(file)
> src << "File \"[file]\" downloaded."
> else
> src << "There are no shared files added."
>

I hope I helped.

Unknown Person <<

well it works a bit...
but the download system doesnt work...
please fix it..
cuz i'm a bit confused in this..
a normal easy file send verb/proc would also help..
normally i search this up in my old coding, but i formatted my pc -_-