How to save uploaded image using Primefaces without database? - image

I'm working on student registration form on Java web. I'd like to save uploaded image using Primefaces component and then display image in web page. The problem is that I will not use any database to store image.
So how can I code in managed bean because I couldn't understand how to do step by step?

You may store the uploaded file into your physical machine, and if you do not want to use the db, you may store the path and filename into some flat file or xml file. This will help you in retrieving the image for further use in your project.

Related

SpringMVC: What is the best strategy to display an Image?

May I know what is the best strategy to display an image (blob) from database.
using Spring MVC.
Should I load all the image at once from db or create a controller method to get the images individually?
Some tutorial link will be greatly appreciated.
Save the file on the server rather than the DB, serve up the link address to the file through the controller.
The images should be in a cdn location or similar and the Spring controller just returns a url to them.
EDIT :
If you really must serve up the image from the DB and serve it as bytes, you can find the answer you want here

How to populate image thumbnails (image grid) on my web page using JSP

I wants to populate image thumbnails (image grid) on my web page using JSP. Please suggest the best way. Also please suggest what should I store in the DB, image in binary format or path of the image in text format ?
The correct answer would be It depends on your project requirements
I would like to write my experience, if the images had to be prevented from un-authorized access then database would be a good option, but ASAIK I haven't developed any such application in past 3 years. I would just prefer putting up the images in a folder and then have their name in DB for reference purposes.
I just thing database has more important information to store & retrieve and I don't want to choke the database connections retrieving images.

Joomla store files in database

I am using Joomla 2.5
I want to store user uploaded content (like images or general files) in the database instead of in the server.
Is there any existing setting which can be used to do this by default?
Note: I am interested in the user uploaded files. Joomla's own files can stay on the server or on in the database, either is fine by me.
The database doesn't store things like images, its stored information. Images and so on are always stored on the server. The only thing you could do is once an image is uploaded to the server, it stored information about it such as the format, dimensions etc in the database. Would be a good idea to use a gallery such as Phoca Gallery or JoomGallery. More can be found here.
If you are looking for a general file uploader then feel free to use my SWFUpload Component which is only for uploading in the admin backend however is a very simple component therefore will be easy to integrate into other components should you need to.

Upload pdf on a server with Spring MVC

i try to create a web site where it will provide an option to the user to upload a pdf file. I want this pdf to be saved on the server with specific url. For example:
The user select the title.
The user upload the file.
I want after these actions the file to be accessible via a specific url/name_the_user_give.
I saw that the Spring MVC provides very easy interface for file uploading.I already see many tutorial about this but my problem is how can i save the paper into a server.Also i want the pdf to open by the browser's tools.Can anyone give me directions?
To save the file on server path you simply needs to write the file stream to the path described by
request.getServletContext().getRealPath("your directory name here");
and then create the file using the real path you get.
And to show the pdf file using browser plugin, you should use following in your controller method.
#RequestMapping(value="url to map", produces={"application/pdf"})
Hope this helps you.
Cheers.

Is there a way to overwrite existing Blobs in the blobstore

I'm using the high performance image serving feature in App Engine to serve up images from the blobstore. However, I'd like users to be able to modify those images (e.g. rotate, crop etc.) and then write those change back to the blobstore, overwriting the original blob. I know I can write to new blobs in the blobstore, as documented here: http://code.google.com/appengine/docs/python/blobstore/overview.html#Writing_Files_to_the_Blobstore
but I don't see a way to overwrite existing blobs. Is this possible in App Engine?
My use case is as follows:
User uploads image, and app engine generates a link via
get_serving_url
The user may then use that link outside of my app, e.g. link to it
on their blog to display the image
If that image is changed later on in my app (rotation, etc.) , I'd
like their image link to reflect those changes
Files stored in blobstore are immutable, once they have been written than can not be changed (only served or deleted).
I think you should try to build your own controller for generate file serving url
- In Datastore each blobFile record have own ID (you manage it) and version ID
- for first upload , set new ID and version
- When user change your image, save new blobstore, keep ID and set new version field
In serving controller generate link by iD, when user call it, get the newest version for serving
It's just my opinion, hope it helpful !

Resources