There is a problem with the random filename logic in Plug when run on Windows, because :os.timestamp does not give microsecond resolution - at this point in the code:
https://github.com/elixir-lang/plug/blob/master/lib/plug/upload.ex#L102
Typically:
iex(1)> IO.inspect :os.timestamp; IO.inspect :os.timestamp
{1496, 22882, 547000}
{1496, 22882, 547000}
And as there are only 10 reties, it sometimes results in:
** (Plug.UploadError) tried 10 times to create an uploaded file at C:\Windows\TEMP/plug-1495 but failed. Set PLUG_TMPDIR to a directory with write permission
See pull request:
https://github.com/elixir-lang/plug/pull/560


















