Where to upload files in Tomcat? - java

I have a web application developed using Servlet and JSP, we will be hosting this in Daily Razor Privat Tomcat Hosting soon.
But, now we have a problem. We have a form where the users can upload files to the server, files like images and PDF's. Now, we are not sure in which place we should save these files in server. I have seen lot of Stackoverflow answers telling the user to use the path like "C:/Upload/.." but this is a real product, so this is not gonna work.
I contacted the hosting company about this matter and all they said is they will give the FTP logging details once I purchased the system, no word about where to upload the files.
I also thought about uploading to Amazon S3, but we have to create folders "dynamically" for each user and subfolders for their uploaded content, therefor I am not so sure about S3. Apart from that, I believe S3 will drain my wallet.
Any advice about the upload location in tomcat or an alternate will be really appreciated.

But, now we have a problem. We have a form where the users can upload files to the server, files like images and PDF's. Now, we are not sure in which place we should save these files in server.
If you're talking about long-term storage then there's no correct answer here. You'd just need to find a place on the server where your Tomcat user has permissions to write and configure the application to put them there.
I contacted the hosting company about this matter and all they said is they will give the FTP logging details once I purchased the system, no word about where to upload the files.
Once you have FTP details, you should be able to connect to the server and look at the file system. Presumably this would allow you to see the path where your application will be deployed. From there, it's just a matter of picking a location where you'd want to save the files.
I'm not familiar with that hosting provider, so I can't really same more.
I also thought about uploading to Amazon S3, but we have to create folders "dynamically" for each user and subfolders for their uploaded content, therefor I am not so sure about S3. Apart from that, I believe S3 will drain my wallet.
This can also be a good option, depending on your needs. Price is definitely something to evaluate. Demand and bandwidth on your hosting environment are others. If you have high demand on these resources, putting them on AWS will take the load of your server and not eat up the bandwidth allocation from your hosting provider.
You could also store your uploads in a database. I'm not personally a fan of this, but some people do it and I hear it works fine for them.

Related

need help to store many documents from a java web app

i have a little issue. I hava to generate thousands of files from a web application. I will then put them into a zip send it by mail and delete them. I was thinking about storing them on the jboss server, but i'm not a big fan of this solution.
any idea of a cleaner solution?
If you send the files as an attachment, the files are stored on the mail server and there's no need to store them anywhere else. On the other hand, you might run into size limitations. If your files are too big to be directly attached to an email, you might consider storage services like AWS S3.

Most suitable location to store uploaded images using the Spring Framework

I am currently developing a web application for a local company using Java, Spring Framework and MySQL no ORM. This is the first time I have dealt with uploading files.
My situation is that part of the system allows an admin user to upload images for store items.
currently all my resources such as images are organised and located like such: (located in the unpacked .war at the ROOT of my tomcat server)
/resources/img/items/
/resources/img/items/thumbnails
However I have come to the realisation that when the web app is deployed and a user uploads an image, it will be stored in the above locations. Therefore when I redeploy, the uploaded images will not be present.
My question, is there a better location to store these images? Or am I missing something. I have been researching for the past couple of hours and seem to have not gotten far. I'd be very thankful to anyone who could offer some knowledge. Thanks in advance.
There are many options where to store files.
MySQL: Store them in your MySQL database using the BLOB datatype. The advantage is that you have all your persistent data in a single location which is handy when doing backups. On the other hand, image data may bloat your database quickly.
In the file system: Store them in the file system, e.g. in /var/yourapp/uploaded-images. You need to tell your application about where to find that directory. There are many ways to do this:
create a configuration table in your MYSQL and put the folder there
let your web container/server provide that variable
via JNDI service
...
Make sure you have a rescue plan when that disk crashes with tons of data ^^
Separate Database
Since image data may bloat your database quickly, you may want to use another database for your images. In many architectures binary data are separated from the "real" business data.
I guess these are the typical solutions to your problem. However, there is no standard recommendation what to choose for it depends on facts you didn't provide, or cannot provide at the moment:
Are the images business-critical (technical drawings)
Size of the images (8kB JPEG vs. 200 MB raw image)
What are the demands of your users and who are they (SaaS vs small intranet application)
... many more ;)
Whatever you choose, it is better than storing files in the exploded war :)

Java or PHP Applet to download groups of files from Amazon S3

I have a website that provides a photo service for clients. I want to use Amazon S3 as the storage space for all the photos but am having trouble interacting with the S3 buckets. What I need to do is give my customers access to all their photos sitting in their S3 bucket. I'd like to give them a visual display of all the images and then allow them to select a group or all of the photos for download. I'm assuming a Java applet is needed to handle this interaction. Does anyone know of a java based downloader that will interface with S3 or could possibly build one?
We've also thought of all or a group of files that reside on S3 but can't figure out how to zip files while they're on S3.
Any help is much appreciated!
I suppose when you mean by java based downloader you're talking about web services, sincerely I don't know much about Amazon S3 web services, but I do know they exist, and what I'd advise is to first get to know the Amazon web services, try to find if there is any web method to download the files (my bet is that it has to be a bit per bit download)
Concerning java applet you would only need it if you want to upload files, because of the existing security.

Saving Large file using GWT + GAE + S3 path

I'm building app that will store large video files to the server and then user will be able to view them. For my app I'm using GWT + GAE/J and to store files I would like to use S3 account. But as we know that you can upload max 10mb to GAE. I have asked this kind of question before and the answer that I have accepted will work only if you have file less then 10mb. That solution that KevMo have suggested uploads whole files to the server but what if my file is 20mb or 100mb. Is it possible to divide that file into 10mb peaces, send them to GAE and then assemble those files on S3 server.
Here is the picture of what I'm trying to accomplish here:
Thanks
Why not have your GWT client upload the video directly to S3? You can have your app engine code create the authentication token or password or whatever S3 calls it, and then your GWT client would send the file straight there. If need be, it could pass back whatever meta data that your app engine code needs.(file size, name, whatever)
see this question for more info on giving users permission to upload to S3:
PS - obviously this doesn't work quite as well if you are doing some kind of processing to the video in your app engine code before uploading it to S3alt text http://www.freeimagehosting.net/uploads/b49fdee149.jpg
I'd highly recommend developing your own transfer control instead. Likely it will take the same amount of time.

Java Applet to manage file uploads to server

Looking for a descent looking Java File Upload Applet (or even Flash) that fits the following requirements:
Free/cheap (yes looking to use in a commercial web application)
Preferably allow multiple file selection
Ability to create/edit folders on destination server? (within a secure root folder)
Ability to overwrite files in the destination directory?
IE + Firefox support required... Safari, Chrome, etc. a bonus
Ability to "hook" into the flow to apply additional logic
Notes:
In particular I'm looking for the ability to upload to a directory on another server (e.g. not where my web server or app server is running)
The destination server has a shared drive where all users of the app have permission to store files.
By "decent looking" I'd really, really like to avoid a UI that is "skinned" like this:
(source: swtguibuilder.com)
Before I'm shut down for "not programming related" I would need to be able to hook into such an applet to apply some additional permission logic etc. I don't want to re-invent the wheel if someone else has made a component that already does what I need.
This is relatively easy with Java. Look into Apache Commons Fileupload for the server-side code. For the front-end, there are many examples of flash-based file uploads.
The simple answer to your question used to be Flash. Since the release of Flash Player 10 it isn't anymore. Adobe has added a restriction on File upload which only allows a file to be uploaded in the scope of UIA - User Initiated Action. This means that a file upload must be started with a mouse click.
There are some of free file uploaders built in flash available. The only problem is that the queuing is broken by FP10. Adding the files to the pending uploads list is no problem. Starting the upload is no problem either. But when one file upload is done and the next should begin, Flash Player will not allow it if you don't click again which is pretty much useless.
There at least two requirements:
Applet file uploader These are available, e.g.: http://sourceforge.net/projects/jupload/
Widget to configure destination This is unusual in my experience, but I wrote one once for a Swing app which would be similar for an applet. It was necessary to provide the user a view of the remote file system, enable manipulation of the view, and then upload the changes. Note that there are transactions issues here, so it's not trivial.

Categories

Resources