Where to store web application uploaded files? - grails

I'm developing a web application using Grails.
I'm wondering where should I store the uploaded files (pictures, pdf ...) ? in the application server? a remote ftp server? or where ?

It depends
what you want to do next time with this files
do you want to allow to download those
how many clients and how big traffic to those files has your application
how many files foresee to have
The easiest way is the best, so you can start simply store files in local filesystem.
Good practics is to create dedicated calss/service for suporting file storage, when in the feature you want store files elsewhere you only have to change implementation in one place.

Related

Is it possible to create a social network where data is stored on user's computer?

I'm searching a way to make a social network where the data (images, videos...) is stored on the user's computer (or client-side) and a remote server is used to access it by serving the functionnality and the design. The basic thing would be for each user to have a profile and to be able to browse other's profiles.
Note : It's not a problem if the client-side computer shuts down its machine. The user's profile would be just designed as offline. And when the user is connected, others would be able to browse his – her profile.
I searched a lot and I came up with different ideas :
→ store data with indexeddb and then stream it with webrtc. The problem : webrtc is not really made for showing a simple profile page to be browsed by multiple users.
→ make a desktop app to access local files and then try to make a communication with the server to deliver the app (with something like electron ?). The problem is I don't know if electron is well suited for this kind of project.
Any ideas, questions, suggestions, remarks or anything that helps would be greatly welcomed.
We have an application which i a Cloud Screen service/application. The purpose of the application is to store images and videos locally but also on the server. So if a computer connects to the network, it'll download the current content (json, images, videos) so it can display these even without internet because it's stored locally.
The client was made in Electron and the management application was .NET Core.
If you're thinking about creating a desktop application, then yes, it is possible, but in order to achieve this, you have to store on the server as well.
Let's assume that someone wants to check your profile. It has to load your datas which has to be stored on the server because they can't access your local files and computer. But you can store your files locally to boost up the speed.
I would only recommend this to store images/videos and bigger files, but you have to specify your requirements because in this case, every time you bump into a new content, you have to download it (if you want to store locally so it'll load faster the stored files).
The second option is to store these in the client. But be aware, desktop application's size can increase easily with lots of images and videos. If you store these in the client, you only have to store the URLs in case of dynamic datas (static URLs can be stored as static data).
I hope I could help, if you have any more questions, feel free to ask.

Access MP3 files on server from iOS.

I'm building a streaming app similar to pandora. However right now I'm storing all my files on http and accessing them with urls. Is there an alernative to this because all the files are in the public html folder? For example how does apps like pandora or spotify pull files off their servers. I'm new to web severs and not sure where to ask this question. I have a centos server on vps hosting with apache, MySQL, http, ftp.
You just need to provide the content as a bit stream rather than a file download. The source of that data to send as a stream can be stored as binary data in a BLOB column in a database or as a regular file on a non-public part of the file system. It really does not mater which one you use.
Storing them in the database gives your app a bit easier access and makes the app more portable since it is not restricted the file system level permissions.
The fact you currently have the files in a public folder is not really that critical of an issue since you are making them available for download. You would just need to make sure you have an authentication requirement if you want to restrict who can access them.

How does Dropbox upload data to its servers?

just recently I was thinking and wondered, how does Dropbox upload my files to its S3 storage and how might that one be organized?
Let's just completely forget about the sync aspect for a second and scale the problem down to one S3 bucket.
Say, in that bucket's root directory you have lots of folders, each belonging to an arbitrary user.
Now if that user wants to upload a file to his folder... how does that happen internally? I mean, Dropbox can't just store the Amazon S3 access credentials/keys hard-coded into the application (be it on ios or windows) as it might get reverse-engineered and thus exposed.
Any thoughts on this?
Thanks!
Some guys from EADS did reengineering on Dropbox, the presentation slides are available for download: A CRITICAL ANALYSIS OF
DROPBOX SOFTWARE SECURITY
In the same way websites don't allow users to directly access their databases but rather provide interfaces that can control permissions and handle authentication, I'm sure Dropbox has some kind of application that the client on your computer interacts with. Their server daemon will have permissions to write to the disk, but your computer has to go through it (and it's security procedures) before anything your computer sends is written.

How to upload a file into server hard disk. using mvc

I am learning mvc3 and I wanted to know which will be the better way to upload a file and store to the server hard disk, I know how save in the database and saw this example for store in App_Data, which will be the approach to upload a file and store to the server hard disk?
File Upload ASP.NET MVC 3.0
Just call file.SaveAs() with any path on the server's disk that you have write access to.
There are different opinions about this. You should prefer hard disk storage when performance is important and files are big and database when you need transactional integrity between the files and the associated metadata.

Where to save scraped images?

I'm building a Ruby on Rails app that scrapes the images off a website. What is the best location to save this images to?
Edit:
To be clear, I know the file system is the best type of storage, but where on the file system? I suppose I have to stay in the RoR app directory, but which folder is best suitable for this? public?
On your file server (static Apache server), on your app server (save some where locally in the disk and serve via the app server) or on Amazon S3
But I would suggest not to store in Database. (Some people think it's alright. So, I would be limited to suggestion)
in ROR, under <app_name>/public/images see here -- but the data will be public. If you are worried about privacy, probably this is not right.
If you are concerned about privacy, see the options discussed here How to store private pictures and videos in Ruby on Rails But as a sughestion: serving files from app-server may be painful in high traffic conditions and my experience is it better off-loaded to a file server or a cloud like S3.
It's not hard to write and/or create a server that is only serving images from a file store outside your website's directory structure. A simple rewrite of the URL can provide your code with the info it needs to the actual file location, which it then outputs to the browser.
An alternate is to have the image's URL mapped to the image's directory path in a database, then do a lookup. Make the URL field an indexed lookup and it will be very fast.
I wrote an image server in Ruby a couple years ago along those lines and it was a pretty simple task.

Resources