P
Peter Bailey
Hi,
I'm working with a colleague over in Unixland in our company. I'm down
in Windowsland. He tells me that, using this same script below from
Unix, he can transmit PNG files properly to our target. I can't, though.
I don't get any error message. There's a pregnant pause when I run this
script, with a bunch of PNG files in my directory, but, when I go and
check the URL for the target, nothing's gone over. I've changed the
names to protect the innocent.
Does anyone know of any inherent problems with net/http under Windows?
Thanks.
require 'net/http'
require 'FileUtils'
host = "graphics-devl.mycompany.com"
port = 80
Dir.chdir("F:/workflows/graphics/png2orca/")
Dir.glob("*.png").each do |file|
image_contents = IO.read(file)
dir, file_name = File.split(file)
image_name = file_name.sub!(/\..*/, "")
Net::HTTP.start(host, port) do |http|
req = Net::HTTP:ost.new("/image/loader/#{image_name}")
req.basic_auth 'username', 'password'
req.set_content_type("image/png")
req.body = image_contents
response = http.request(req)
end
FileUtils.rm(file)
end
I'm working with a colleague over in Unixland in our company. I'm down
in Windowsland. He tells me that, using this same script below from
Unix, he can transmit PNG files properly to our target. I can't, though.
I don't get any error message. There's a pregnant pause when I run this
script, with a bunch of PNG files in my directory, but, when I go and
check the URL for the target, nothing's gone over. I've changed the
names to protect the innocent.
Does anyone know of any inherent problems with net/http under Windows?
Thanks.
require 'net/http'
require 'FileUtils'
host = "graphics-devl.mycompany.com"
port = 80
Dir.chdir("F:/workflows/graphics/png2orca/")
Dir.glob("*.png").each do |file|
image_contents = IO.read(file)
dir, file_name = File.split(file)
image_name = file_name.sub!(/\..*/, "")
Net::HTTP.start(host, port) do |http|
req = Net::HTTP:ost.new("/image/loader/#{image_name}")
req.basic_auth 'username', 'password'
req.set_content_type("image/png")
req.body = image_contents
response = http.request(req)
end
FileUtils.rm(file)
end