我想从ruby脚本上传图像到运行Sinatra的服务器,对于我的生活我无法弄清楚。 这是我到目前为止。 服务器: post '/uploads/:filename' do
File.open("./uploads/#{params[:filename]}", 'wb') do |f|
f.write(params[:filename].read)
end
end
我不明白,为什么在条件不工作, 我想执行的一部分,如果用户名和密码都为空 post '/login' do
credentials = CGI.parse request.body.read
if credentials['username'].nil? || credentials['password'].nil?
status 603
return