Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Open Rednet on the same side as the server
- rednet.open("top")
- -- Prompt user to enter the server ID
- print("Enter Server ID:")
- local serverId = tonumber(read())
- -- Prompt user to enter the file to send
- print("Enter File Name to Send:")
- local fileName = read()
- -- Read the file content to send
- local fileContent = ""
- local file = fs.open(fileName, "r")
- if file then
- fileContent = file.readAll()
- file.close()
- -- Send the file content to the server using the specified ID
- local success = rednet.send(serverId, fileContent, "file_transfer")
- if success then
- print("File sent to the server")
- else
- print("Failed to send the file. Check server ID or Rednet connection.")
- end
- else
- print("File not found or could not be read.")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement