Multipart date post file (txt) in ruby on rails app
€8-30 EUR
処理中
投稿日: 6年以上前
€8-30 EUR
完了時にお支払い
Hello,
I'm building a website for the management of an hotel.
I'm trying to post a txt file to an external server (police), but i'm a beginner so need some help.
The file (which i generate) have to be send to a server with the following caracteristic:
ENCTYPE="multipart/form-data"
METHOD="POST"
type="file"
name="fichero"
the url is : https://usuario:contrase%C3%B1a@[login to view URL]
usuario is ID
and contrase is Password
So far i've written this using multipart but nothing it coming through:
require 'net/http/post/multipart'
url = [login to view URL]("https://" + username + ":" + password + "@[login to view URL]")
[login to view URL](filep) do |jpg|
req = Net::HTTP::Post::[login to view URL] [login to view URL], "file" => [login to view URL](jpg, "file", "document")
http = Net::[login to view URL]([login to view URL], [login to view URL])
http.use_ssl = ([login to view URL] == "https")
response = [login to view URL](req)
redirect_to account_path
flash[:notice] = "data send to police"
end
end
---------------------------
Let me know if you can help me :)
Thanks in advance