{"action":"created","issue":{"url":"https://api.github.com/repos/carrierwaveuploader/carrierwave/issues/1662","labels_url":"https://api.github.com/repos/carrierwaveuploader/carrierwave/issues/1662/labels{/name}","comments_url":"https://api.github.com/repos/carrierwaveuploader/carrierwave/issues/1662/comments","events_url":"https://api.github.com/repos/carrierwaveuploader/carrierwave/issues/1662/events","html_url":"https://github.com/carrierwaveuploader/carrierwave/issues/1662","id":85246068,"number":1662,"title":"\"Errno::ENOENT No such file or directory\" using fog unless config.delete_tmp_file_after_storage = false","user":{"login":"fignuts","id":858965,"avatar_url":"https://avatars.githubusercontent.com/u/858965?v=3","gravatar_id":"","url":"https://api.github.com/users/fignuts","html_url":"https://github.com/fignuts","followers_url":"https://api.github.com/users/fignuts/followers","following_url":"https://api.github.com/users/fignuts/following{/other_user}","gists_url":"https://api.github.com/users/fignuts/gists{/gist_id}","starred_url":"https://api.github.com/users/fignuts/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/fignuts/subscriptions","organizations_url":"https://api.github.com/users/fignuts/orgs","repos_url":"https://api.github.com/users/fignuts/repos","events_url":"https://api.github.com/users/fignuts/events{/privacy}","received_events_url":"https://api.github.com/users/fignuts/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":{"login":"plribeiro3000","id":672952,"avatar_url":"https://avatars.githubusercontent.com/u/672952?v=3","gravatar_id":"","url":"https://api.github.com/users/plribeiro3000","html_url":"https://github.com/plribeiro3000","followers_url":"https://api.github.com/users/plribeiro3000/followers","following_url":"https://api.github.com/users/plribeiro3000/following{/other_user}","gists_url":"https://api.github.com/users/plribeiro3000/gists{/gist_id}","starred_url":"https://api.github.com/users/plribeiro3000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/plribeiro3000/subscriptions","organizations_url":"https://api.github.com/users/plribeiro3000/orgs","repos_url":"https://api.github.com/users/plribeiro3000/repos","events_url":"https://api.github.com/users/plribeiro3000/events{/privacy}","received_events_url":"https://api.github.com/users/plribeiro3000/received_events","type":"User","site_admin":false},"milestone":null,"comments":3,"created_at":"2015-06-04T19:41:30Z","updated_at":"2015-11-18T08:21:34Z","closed_at":null,"body":"Attempting to save an image to S3 using fog fails with\r\n\r\n    Errno::ENOENT (No such file or directory @ rb_sysopen - /path/to/my_app/public/uploads/tmp/1433445809-40745-4105/6_b.jpg):\r\n\r\nunless I set ```config.delete_tmp_file_after_storage = false``` in which case it succeeds, but the files are left sitting in the folder. It appears that carrierwave is deleting the tmp file before it is finished using it. I don't want to leave those temp files sitting around or be forced to clean them up with a background job if I don't have to.\r\n\r\nRelevant gem versions\r\n```\r\nUsing rails 4.2.1\r\nUsing carrierwave 0.10.0\r\nUsing fog-core 1.30.0\r\nUsing fog-aws 0.4.0\r\n```\r\n\r\nMy config\r\n```\r\nCarrierWave.configure do |config|\r\n    config.storage = :fog\r\n    #config.delete_tmp_file_after_storage = false\r\n    config.fog_credentials = {\r\n        :provider               => 'AWS',   \r\n        :aws_access_key_id      => ENV['AWS_ACCESS_KEY'],      \r\n        :aws_secret_access_key  => ENV['AWS_SECRET_KEY'],       \r\n        :region                 =>  'us-west-1' #provides instant read consistency\r\n    }\r\n    config.fog_directory  = 'myapp-static'    \r\n    config.asset_host       = 'https://static.myapp.com'   \r\n    config.fog_public     = false    \r\n    config.fog_attributes = {'Cache-Control'=>'max-age=315576000'} \r\nend\r\n```\r\n\r\nMy uploader\r\n```\r\nclass ImageUploader < CarrierWave::Uploader::Base\r\n\r\n  def store_dir\r\n    \"images/#{secure_token}\"\r\n  end\r\n\r\n  def secure_token\r\n    if model.image_uuid?\r\n      return model.image_uuid\r\n    else\r\n      model.update_attribute \"image_uuid\", SecureRandom.uuid\r\n      return model.image_uuid\r\n    end\r\n  end\r\n\r\n  def extension_white_list\r\n     %w(jpg jpeg gif png)\r\n  end\r\n\r\nend\r\n```\r\n\r\nMy model\r\n```\r\nclass Image < ActiveRecord::Base\r\n  belongs_to :user\r\n  validates_presence_of :user\r\n  mount_uploader :image_content, ImageUploader\r\nend\r\n```\r\n\r\nMy controller action\r\n```\r\ndef create\r\n    image = Image.new(:user_id => current_user.id, :username => current_user.username)\r\n    image.image_content = params[:file]\r\n    if image.save\r\n      render :json => {'filelink' => \"/images/\"+image.id}\r\n      return\r\n    else\r\n      render :json => {error: \"failed to save\"} \r\n    end\r\nend\r\n```"},"comment":{"url":"https://api.github.com/repos/carrierwaveuploader/carrierwave/issues/comments/157641866","html_url":"https://github.com/carrierwaveuploader/carrierwave/issues/1662#issuecomment-157641866","issue_url":"https://api.github.com/repos/carrierwaveuploader/carrierwave/issues/1662","id":157641866,"user":{"login":"thomasfedb","id":193831,"avatar_url":"https://avatars.githubusercontent.com/u/193831?v=3","gravatar_id":"","url":"https://api.github.com/users/thomasfedb","html_url":"https://github.com/thomasfedb","followers_url":"https://api.github.com/users/thomasfedb/followers","following_url":"https://api.github.com/users/thomasfedb/following{/other_user}","gists_url":"https://api.github.com/users/thomasfedb/gists{/gist_id}","starred_url":"https://api.github.com/users/thomasfedb/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/thomasfedb/subscriptions","organizations_url":"https://api.github.com/users/thomasfedb/orgs","repos_url":"https://api.github.com/users/thomasfedb/repos","events_url":"https://api.github.com/users/thomasfedb/events{/privacy}","received_events_url":"https://api.github.com/users/thomasfedb/received_events","type":"User","site_admin":false},"created_at":"2015-11-18T08:21:34Z","updated_at":"2015-11-18T08:21:34Z","body":"@plribeiro3000 Have you had a chance to look into this issue?"}}