Hi, When running my app in development with WEBrick in daemon mode I get the following error when trying to upload a file: Errno::ENOENT in UploadController#create No such file or directory - public/data/upload/google |Rails.root: /home/resource_portal/website| Application Trace <http://localhost:3000/upload#> | Framework Trace <http://localhost:3000/upload#> | Full Trace <http://localhost:3000/upload#> |app/models/upload.rb:29:in `initialize'' app/models/upload.rb:29:in `open'' app/models/upload.rb:29:in `filesave'' app/controllers/upload_controller.rb:16:in `create'' rake-0.8.7/ruby/1.9.1/gems/actionpack-3.0.3/lib/action_controller/metal/implicit_render.rb:4:in `send_action'' rake-0.8.7/ruby/1.9.1/gems/actionpack-3.0.3/lib/abstract_controller/base.rb:151:in `process_action''| ... I do not get this error when not running in daemon mode. I''ve googled a bit but can''t find a reason. Does anyone have any ideas? Also the reason I want to run in Daemon mode is because I have to host my app on a uni virtual machine, and start the server after logging in with ssh. When I close the ssh connection the server (if not running in background) also seems to get killed. Any ideas as to how I may be able to work around this? Thanks, Jen. -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Hassan Schroeder
2011-Jul-03 14:53 UTC
Re: Can''t upload files when WEBrick running in daemon mode.
On Sun, Jul 3, 2011 at 6:19 AM, Jen <jen.bottom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote:> When running my app in development with WEBrick in daemon mode I get the > following error when trying to upload a file: > > Errno::ENOENT in UploadController#create > > No such file or directory - public/data/upload/google> I do not get this error when not running in daemon mode. I''ve googled a bit > but can''t find a reason. Does anyone have any ideas?My guess would be that ''current working directory'' doesn''t mean the same thing to a daemonized process; how are you specifying the target directory? Regardless...> Also the reason I want to run in Daemon mode is ...Why Webrick? It''s only intended for desktop development work; you would be better off using e.g. unicorn (my preference) or passenger in a production environment. Alternatively, if those aren''t an option, see if you have `screen` on the system you''re using (http://www.gnu.org/software/screen/). HTH, -- Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org http://about.me/hassanschroeder twitter: @hassan -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Paulo Muggler Moreira
2011-Jul-04 14:42 UTC
Re: Can''t upload files when WEBrick running in daemon mode.
I personally use mongrels for my development chops, and passenger in production environments; I have yet to take the unicorn for a ride. I advise you to drop WEBrick entirely. Also, be sure to look at this security considerations <http://guides.rubyonrails.org/security.html#file-uploads> if you haven''t yet done so. Security always bears reminding... []s, Paulo Muggler On Sun, Jul 3, 2011 at 11:53, Hassan Schroeder <hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>wrote:> On Sun, Jul 3, 2011 at 6:19 AM, Jen <jen.bottom-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org> wrote: > > When running my app in development with WEBrick in daemon mode I get the > > following error when trying to upload a file: > > > > Errno::ENOENT in UploadController#create > > > > No such file or directory - public/data/upload/google > > > I do not get this error when not running in daemon mode. I''ve googled a > bit > > but can''t find a reason. Does anyone have any ideas? > > My guess would be that ''current working directory'' doesn''t mean the > same thing to a daemonized process; how are you specifying the target > directory? Regardless... > > > Also the reason I want to run in Daemon mode is ... > > Why Webrick? It''s only intended for desktop development work; you > would be better off using e.g. unicorn (my preference) or passenger > in a production environment. > > Alternatively, if those aren''t an option, see if you have `screen` on the > system you''re using (http://www.gnu.org/software/screen/). > > HTH, > -- > Hassan Schroeder ------------------------ hassan.schroeder-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org > http://about.me/hassanschroeder > twitter: @hassan > > -- > You received this message because you are subscribed to the Google Groups > "Ruby on Rails: Talk" group. > To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > To unsubscribe from this group, send email to > rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org > For more options, visit this group at > http://groups.google.com/group/rubyonrails-talk?hl=en. > >-- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.
Jen
2011-Jul-16 10:22 UTC
Solved! Re: Can''t upload files when WEBrick running in daemon mode.
Hi, I solved this by including the absolute path to the directory where the uploaded files are placed. Now the code is: #takes the upload object and extracts the file. def filesave #Calls the .original_filename method on the upload object and stores in the variable name name = upload.original_filename directory = "/home/resource_portal/website/public/data/upload" ... This works with WEBrick, but am now using thin. Hope this helps anyone else experiencing the same problem. Cheers, Jen! -- You received this message because you are subscribed to the Google Groups "Ruby on Rails: Talk" group. To post to this group, send email to rubyonrails-talk-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org To unsubscribe from this group, send email to rubyonrails-talk+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/Ez6ZCGd0@public.gmane.org For more options, visit this group at http://groups.google.com/group/rubyonrails-talk?hl=en.