Warning: file_get_contents(/data/phpspider/zhask/data//catemap/7/elixir/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Elixir Plug.Upload在Changeset.cast上失败…仅在Windows上_Elixir_Ecto_Arc Ecto - Fatal编程技术网

Elixir Plug.Upload在Changeset.cast上失败…仅在Windows上

Elixir Plug.Upload在Changeset.cast上失败…仅在Windows上,elixir,ecto,arc-ecto,Elixir,Ecto,Arc Ecto,在我的应用程序中,用户可以“导入”一张照片,服务器将图像下载到本地文件系统,将结果放入Plug.Upload,并在存储到数据库的路径之前使用Arc.exto执行一些操作。这一切在Debian中运行良好,但在我的Windows 10机器上的exto.Changeset.cast过程中失败了 File.mkdir("/tmp/import/") filename = UUID.uuid4() <> "." <> extension path = "/tmp/import/"

在我的应用程序中,用户可以“导入”一张照片,服务器将图像下载到本地文件系统,将结果放入Plug.Upload,并在存储到数据库的路径之前使用Arc.exto执行一些操作。这一切在Debian中运行良好,但在我的Windows 10机器上的exto.Changeset.cast过程中失败了

File.mkdir("/tmp/import/")
filename = UUID.uuid4() <> "." <> extension
path = "/tmp/import/" <> filename
File.write!(path, imgbinary)
results
|> Map.put("photourl",%Plug.Upload{filename: filename, path: Path.absname(path)})
|> do_stuff_and_then_get_passed_to_changeset
与unix等效(无问题):

我的模式的一部分:

 field :photourl, ImageUploader.Type
 #(photourl is stored as text in postgres db)
变更集的错误部分:

错误:[photourl:{“无效”, [类型:ImageUploader.type,validation::cast]}]


我不太确定如何进一步调试它。我想知道它是否与我的路径有关(但它对两种环境都有效,并且文件也存在)。

我想文件的路径对Windows上的ImageUploader无效。
"photourl" => %Plug.Upload{content_type: nil,
   filename: "17c032be-0237-4981-a9e5-1cfe693aed51.jpg",
   path: "/tmp/import/17c032be-0237-4981-a9e5-1cfe693aed51.jpg"},
 field :photourl, ImageUploader.Type
 #(photourl is stored as text in postgres db)
defmodule ImageUploader do
  use Arc.Definition
  use Arc.Ecto.Definition

  def __storage, do: Arc.Storage.Local
  #other stuff that isn't relevant. I think Type comes from Arc or Arc.Ecto?