Skip to content

Validation when uploading from a remote URL #282

Description

@morgz

Environment

  • Elixir version (elixir -v):
    1.8.1
  • Arc version (mix deps):
    {:arc, "~> 0.11.0"},
  • Arc dependencies when applicable (mix deps):
    {:arc_ecto, "~> 0.11.1"},
  • Operating system:
    osx

How can you use

 # Whitelist file extensions:
  def validate({file, scope}) do
      _ -> ~w(.jpg .jpeg .gif .png) |> Enum.member?(Path.extname(file.file_name))
  end

When uploading via a remote URL?

for example: https://graph.facebook.com/10161619653110632/picture?type=square

The file info doesn't give me much to work with:

%Arc.File{binary: nil, file_name: "picture", path: "/var/folders/41/t37wy48124zdh1qwx76cz5y00000gn/T/OJIFYN6COCTZYYE7E4NHGU2E42KWZXCJ"}

Thanks

Dan

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions