Show files on FTP in a Rails App - ruby-on-rails

We have an FTP site for clients, and they just go to it with a web browser and see the files. I'd like to display the files in a more visually pleasing manner, is there a way I can show what files are on the server in the view, perhaps iterate over them and style them?
I found this answer here, but really didn't answer my question:
Ruby-Rails serve ftp file direct to client
(using rails 3 if it makes a difference)

You can use library links below:
http://www.ruby-doc.org/stdlib-1.9.3/libdoc/net/ftp/rdoc/index.html
http://oreilly.com/catalog/ruby/chapter/ch04.html
and you can use EventMachine https://github.com/schleyfox/em-ftp-client.
Cheers!

Related

How to display PowerPoint Presentation In Rails 4 Paperclip??/

In my application, i have uploaded PPT,PPTX files using paperclip gem. I have url like this
" Presentation.last.avatar.url" = "/system/presentations/avatars/000/000/006/original/example.ppt?1411994371"
Now i want to display those PPT, and PPtx files in my localhost web browser. please give me suggestions.. thanks
Assuming you mean that you want them to be embedded in the browser, I've solved this by uploading the them to Scribd in the background and then displaying the embedded widget. This is a great solution because turning a PPT file into clean HTML is hard (so let someone else work it out), and you do not have to pay for hosting or bandwidth for those files.
It's a lot nicer to do it this way than to force the user to have an Office plugin installed for their browser, which depending on their platform they may not have.
The Scribd_fu gem will work with Paperclip, or you could use the official RScribd gem and roll your own.

Using Your Own Text Editor On a Server

Are there any hosting providers which allow you to use your own text editor to edit hosted files? At the moment, I'm using Namecheap and I can only edit hosted files through their code editor which means I need to edit the files locally and then upload them if I want to use my own text editor. I'd really like to develop a site directly on the server so skipping this step would save quite a bit of time.
Specifically, I'd like to use Sublime Text 2. Google didn't help so I'm hoping someone hear could point me in the right direction.
Thanks.
It looks like EasyEditors might have what you need. It appears that you can edit the files on their site.

How do I link to a PDF file in Silex?

I've looked around a bit and can't seem to figure out how to link to a static file while using Silex. I've seen some similar questions/answers in regards to Symfony, but they involved YML routing files, which I don't use with Silex.
My Situation
I have some files in a /docs folder. Logged in users can upload new pdf files (so, I don't know ahead of time what all of the filenames will be; they're constantly changing).
My Intent
I need to be able to link to these PDF files, so that a click on a link somewhere will open www.myurl.com/docs/myfile.pdf.
The Problem
Due to the routing system in silex, it treats the url as a route (obviously) and throws a Page Not Found error.
Thanks in advance for any feedback!
You need to configure your web server in a way that it does not forward existing files to the front controller. The web servers section of the silex documentation has examples of such configurations for the most popular web servers.
As for the link itself, just link to the file directly, something along these lines:
{{ filename }}

Get Plone 4 to import pictures as images and not files when uploading with webdav

I remember back in Plone 2 days I found a simple hack to make one CMFPhoto folder receive webdav files as images (and show them as a gallery).
In Plone4 the images are received as content type files which are not very useful.
Other mass uploading options seem not to be updated to recent versions of Zope/Plone, except uploadify, which makes my server unable to start when installed with buildout.
Functioning webdav would be ideal
Thanks for any ideas, although I can't say I have understood the framework enough to use just a hint
Steen
The short answer is that you need to take a look in the Content Type Registry tool within your site and figure out the settings related to the image (png, jpg) extensions and mime-type that are configured for your site. Visit the Zope Management Interface of your site, and go to ./content_type_registry in he root of your site to take a look.
The more complicated answer is that folders in Plone have a method called PUT_factory() that controls what items get created as. Different folder types can behave differently, but all stock folder types in Plone and most add-ons should obey (unless a bug) the settings in the Content Type Registry.

(Rails) Uploading Directories

I need to upload multiple files on my website.
But I need not just a form for uploading multiple files, I need to upload whole directories.
How's this possible for the minimalist?
Yours, Joern.
According to my somewhat limited knowledge this is not possible, only file transfer is possible, not directories.
Here are some workarounds, based on discussion on Velocity Reviews and another discussion:
upload a zip, which you unzip at the server side
upload directories over ftp (web page can be a front end to this)
upload files one by one
I would go either for zip or ftp. Note: someone might have produced a gem that enables uploading directories (I know nothing of such thing, but I will be happy to find out, if there is).
Adding another option to the list provided by Sorrow:
upload via REST/JSON
OK, this is a partial solution, but it does give you the opportunity to write a script that reads your directory and POSTS to your website.

Resources