I’ve made tiny changes to my code, and right now, I do not see any error message, but the problem is I cannot upload any file/s. When I add a new image and click save it shows “Oops, something went wrong! Please check the errors below.” but doesn’t display anything below. In the terminal, it looks like that:
[debug] Processing with JordanivaWeb.ProductController.create/2
Parameters: %{"_csrf_token" => "Ewo7HQVpOGEiIxsdHkk4TUMsPCsQBR0VpNId63iUIUmRndr72bVramuY", "photos" => %{"category_id" => "1", "colour" => "test1", "description" => "test1", "name" => "test1", "photos" => %{"0" => %{"photos" => [%Plug.Upload{content_type: "text/html", filename: "+ud6zQ2o.html", path: "/var/folders/1t/q27498654m376jz6fl02fqd80000gn/T//plug-1598/multipart-1598452423-991068043046336-5"}, %Plug.Upload{content_type: "image/jpeg", filename: "air_jordan1.jpg", path: "/var/folders/1t/q27498654m376jz6fl02fqd80000gn/T//plug-1598/multipart-1598452423-154324122449949-5"}]}}, "price" => "1111", "product_code" => "test1", "release_year" => "1111", "subcategory_id" => "1", "type_id" => "1"}}
Pipelines: [:browser]
[debug] QUERY OK source="types" db=0.3ms idle=893.5ms
SELECT t0."id", t0."name", t0."inserted_at", t0."updated_at" FROM "types" AS t0 ORDER BY t0."name" []
[debug] QUERY OK source="categories" db=0.2ms idle=894.1ms
SELECT c0."id", c0."name", c0."inserted_at", c0."updated_at" FROM "categories" AS c0 []
[debug] QUERY OK source="subcategories" db=0.2ms idle=894.6ms
SELECT s0."id", s0."name", s0."category_id", s0."inserted_at", s0."updated_at" FROM "subcategories" AS s0 []
[info] Sent 200 in 11ms
IO.inspect in photo controller doesn’t show anything, only in the product’s controller:
%Plug.Conn{
adapter: {Plug.Cowboy.Conn, :...},
assigns: %{
types: [
%Jordaniva.Inventory.Type{
__meta__: #Ecto.Schema.Metadata<:loaded, "types">,
id: 3,
inserted_at: ~N[2020-08-12 10:46:24],
name: "Kids",
updated_at: ~N[2020-08-12 10:46:24]
},
%Jordaniva.Inventory.Type{
__meta__: #Ecto.Schema.Metadata<:loaded, "types">,
id: 1,
inserted_at: ~N[2020-08-12 10:46:24],
name: "Men",
updated_at: ~N[2020-08-12 10:46:24]
},
%Jordaniva.Inventory.Type{
__meta__: #Ecto.Schema.Metadata<:loaded, "types">,
id: 2,
inserted_at: ~N[2020-08-12 10:46:24],
name: "Women",
updated_at: ~N[2020-08-12 10:46:24]
}
]
},
before_send: [#Function<0.73641281/1 in Plug.CSRFProtection.call/2>,
#Function<2.102658996/1 in Phoenix.Controller.fetch_flash/2>,
#Function<0.105793137/1 in Plug.Session.before_send/2>,
#Function<0.60895335/1 in Plug.Telemetry.call/2>,
#Function<0.33293990/1 in Phoenix.LiveReloader.before_send_inject_reloader/3>],
body_params: %{
"_csrf_token" => "Gg03ClYqHGQcRik4EXU4P0MpDBsJHDchyIEsepMPw0_waXrE2gfBxt_m",
"photos" => %{
"category_id" => "1",
"colour" => "test2",
"description" => "test2",
"name" => "test2",
"photos" => %{
"0" => %{
"photos" => [
%Plug.Upload{
content_type: "image/jpeg",
filename: "air_jordan1.jpg",
path: "/var/folders/1t/q27498654m376jz6fl02fqd80000gn/T//plug-1598/multipart-1598449943-267269738935643-2"
}
]
}
},
"price" => "1111",
"product_code" => "test2",
"release_year" => "2222",
"subcategory_id" => "1",
"type_id" => "1"
}
},
cookies: %{
"_jordaniva_key" => "SFMyNTY.g3QAAAABbQAAAAtfY3NyZl90b2tlbm0AAAAYY0RyeTNaUTRrdnZPcC1KenFOallxaGhM.YHsDOvqNysF273T4z74asaQEmNvfLdwOIzE8bjIs3H8"
},
halted: false,
host: "localhost",
method: "POST",
owner: #PID<0.1440.0>,
params: %{
"_csrf_token" => "Gg03ClYqHGQcRik4EXU4P0MpDBsJHDchyIEsepMPw0_waXrE2gfBxt_m",
"photos" => %{
"category_id" => "1",
"colour" => "test2",
"description" => "test2",
"name" => "test2",
"photos" => %{
"0" => %{
"photos" => [
%Plug.Upload{
content_type: "image/jpeg",
filename: "air_jordan1.jpg",
path: "/var/folders/1t/q27498654m376jz6fl02fqd80000gn/T//plug-1598/multipart-1598449943-267269738935643-2"
}
]
}
},
"price" => "1111",
"product_code" => "test2",
"release_year" => "2222",
"subcategory_id" => "1",
"type_id" => "1"
}
},
path_info: ["products"],
path_params: %{},
port: 4000,
private: %{
JordanivaWeb.Router => {[], %{}},
:phoenix_action => :create,
:phoenix_controller => JordanivaWeb.ProductController,
:phoenix_endpoint => JordanivaWeb.Endpoint,
:phoenix_flash => %{},
:phoenix_format => "html",
:phoenix_layout => {JordanivaWeb.LayoutView, :app},
:phoenix_request_logger => {"request_logger", "request_logger"},
:phoenix_router => JordanivaWeb.Router,
:phoenix_view => JordanivaWeb.ProductView,
:plug_multipart => :done,
:plug_session => %{"_csrf_token" => "cDry3ZQ4kvvOp-JzqNjYqhhL"},
:plug_session_fetch => :done
},
query_params: %{},
query_string: "",
remote_ip: {127, 0, 0, 1},
req_cookies: %{
"_jordaniva_key" => "SFMyNTY.g3QAAAABbQAAAAtfY3NyZl90b2tlbm0AAAAYY0RyeTNaUTRrdnZPcC1KenFOallxaGhM.YHsDOvqNysF273T4z74asaQEmNvfLdwOIzE8bjIs3H8"
},
req_headers: [
{"accept",
"text/html,application/xhtml+xml,application/xml;q=0.9,image/webp,*/*;q=0.8"},
{"accept-encoding", "gzip, deflate"},
{"accept-language", "pl,en-US;q=0.7,en;q=0.3"},
{"connection", "keep-alive"},
{"content-length", "83996"},
{"content-type",
"multipart/form-data; boundary=---------------------------12180823701865628394499381825"},
{"cookie",
"_jordaniva_key=SFMyNTY.g3QAAAABbQAAAAtfY3NyZl90b2tlbm0AAAAYY0RyeTNaUTRrdnZPcC1KenFOallxaGhM.YHsDOvqNysF273T4z74asaQEmNvfLdwOIzE8bjIs3H8"},
{"host", "localhost:4000"},
{"origin", "http://localhost:4000"},
{"referer", "http://localhost:4000/products"},
{"upgrade-insecure-requests", "1"},
{"user-agent",
"Mozilla/5.0 (Macintosh; Intel Mac OS X 10.15; rv:79.0) Gecko/20100101 Firefox/79.0"}
],
request_path: "/products",
resp_body: nil,
resp_cookies: %{},
resp_headers: [
{"cache-control", "max-age=0, private, must-revalidate"},
{"x-request-id", "Fi7VwTKakmA5xvwAAAYo"},
{"x-frame-options", "SAMEORIGIN"},
{"x-xss-protection", "1; mode=block"},
{"x-content-type-options", "nosniff"},
{"x-download-options", "noopen"},
{"x-permitted-cross-domain-policies", "none"},
{"cross-origin-window-policy", "deny"}
],
scheme: :http,
script_name: [],
secret_key_base: :...,
state: :unset,
status: nil
}






















