Newer
Older
Loremap / Auto_editsys / user / upload.rb
@Kanan Homma Kanan Homma on 18 Sep 2018 868 bytes you can add map data
#!/usr/koeki/bin/ruby

require "cgi"

cgi2 = CGI.new()

# id = cgi2.params["id"][0].read
file = cgi2.params["file"][0]

if file.size < 1 then
  msg = "ファイルを選択して下さい。"
else
  file_name = file.original_filename.split(/(\\|\/)/)[-1]
  open(Dir.getwd + "/file/#{id}.JPG", "w") {|fh|
    fh.binmode
    fh.write file.read
  }
  msg = "アップロードしました。"
end


# file = cgi2.params["file"][0]
# comment = cgi2.params["comment"][0].read

# file_name = file.original_filename.split(/(\\|\/)/)[-1]
# open(Dir.getwd + "/file/#{}", "w") {|fh|
#   fh.binmode
#   fh.write file.read
# }

print cgi2.header()

print <<EOF
<html>
<head>
  <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
  <title>CMDSmap</title>
<head>
<body>
  #{msg}
<input type="button" value="閉じる" onclick="window.close()">
</body>
</html>
EOF