Rails - Uploading images with paperclip getting Errno::EEXIST

564 views Asked by At

Every time I try create a new article with an image attached I get this error:

Errno::EEXIST in ArticlesController#create File exists @ sys_fail2 - C:/Users/Name/AppData/Local/Temp/44a50f07b4bdc57740901280f9eddaf520170102-12672-1pnp3z2.PNG

Googling around did me no help. I found the file and saw that it only gets created while the local server is running, and I can't delete it manually.

It also says that it extracted it from my articles_controller.rb file:

Extracted source (around line #23):

def create
  @article = Article.new(article_params)

   if @article.save
    redirect_to @article
   else
    render 'new'
   end
end

If you need to see the rest of the files see here - Rails getting error when trying to upload images with paperclip (the previous error was fixed)

1

There are 1 answers

1
mbonez On

In my case, I was getting this because I was using the latest paperclip version in my Gemfile (using the paperclip git url, hence using versio 5.1.0 at the time of this response). To solve this, I simply rolled back to a previous version 4.3.7 and I stopped getting the error. I've pin my app's paperclip to this version until I'm sure of a version of paperclip would allow me to upload.