filehost/ftp server?
#1
Posted 06 December 2012 - 05:34 AM
thanks -Cheeky
#2
Posted 06 December 2012 - 05:38 AM
#3
Posted 06 December 2012 - 05:44 AM
Client:
local args = {...}
for k,v in pairs(rs.getSides()) do
rednet.open(v)
end
if #args ~= 2 then
error("Usage: "..shell.getRunningProgram.." <path> <send ID>")
end
if not fs.exists(args[1]) then
error("File does not exist.")
end
f = fs.open(args[1], "r")
local file = f.readAll()
f.close()
rednet.send(args[2], file)
Server:
local args = {...}
if #args ~= 2 then
error("Usage: "..shell.getRunningProgram.." <save file> <ID>")
endfor k,v in pairs(rs.getSides()) do
rednet.open(v)
end
while true do
id, msg = rednet.receive()
if id == args[2] then
f = fs.open(args[1], "w")
f.write(msg)
f.close()
break
end
end
This is all basic and you should get the basic idea of it.
#5
Posted 06 December 2012 - 06:00 AM
Human, on 06 December 2012 - 05:44 AM, said:
Client:
local args = {...}
for k,v in pairs(rs.getSides()) do
rednet.open(v)
end
if #args ~= 2 then
error("Usage: "..shell.getRunningProgram.." <path> <send ID>")
end
if not fs.exists(args[1]) then
error("File does not exist.")
end
f = fs.open(args[1], "r")
local file = f.readAll()
f.close()
rednet.send(args[2], file)
Server:
local args = {...}
if #args ~= 2 then
error("Usage: "..shell.getRunningProgram.." <save file> <ID>")
endfor k,v in pairs(rs.getSides()) do
rednet.open(v)
end
while true do
id, msg = rednet.receive()
if id == args[2] then
f = fs.open(args[1], "w")
f.write(msg)
f.close()
break
end
end
This is all basic and you should get the basic idea of it.i did this code on my computer:
for i,v in pairs(fs.list("/") do
print(v)
end
and it showed all the directories and files as it should. but when i tried sending "v" over rednet when it was received it would only print the first program. any idea why this is happening?
#6
Posted 06 December 2012 - 06:15 AM
--To make a table a string:
local test = textutils.serialize(fs.list("/"))
--To make a string into a table:
textutils.unserialize(test)
I hope that helps.
#7
Posted 06 December 2012 - 08:42 AM
#8
Posted 06 December 2012 - 08:30 PM
#9
Posted 07 December 2012 - 03:13 PM
#10
Posted 07 December 2012 - 06:31 PM
ChaddJackson12, on 07 December 2012 - 03:13 PM, said:
Derp, you answered your own question. Use Dropbox.
#11
Posted 07 December 2012 - 09:03 PM
ChaddJackson12, on 07 December 2012 - 03:13 PM, said:
#12
Posted 08 December 2012 - 12:16 PM
cheekycharlie101, on 07 December 2012 - 09:03 PM, said:
ChaddJackson12, on 07 December 2012 - 03:13 PM, said:
#13
Posted 09 December 2012 - 08:45 PM
1 user(s) are reading this topic
0 members, 1 guests, 0 anonymous users











