Page 1 of 1

Uploading a File in the Admin

Posted: Thu Feb 28, 2013 4:51 am
by pbechu
Hello !

I'm trying to upload a CSV File in the Admin in order to import data attached with an Entity and I want to upload this file when I add a new Entity.
I tried many things, from the FileUploadDialog to the Media class, but it doesn't work !

Have you maybe suggestions or new ideas ?

Thank you for your time and your help !
Pierre-Baptiste.

Re: Uploading a File in the Admin

Posted: Tue Mar 05, 2013 4:11 pm
by phillipuniverse
You might try looking at how the uploads work in regards to static assets, as that has a good implementation of file upload. Look at StaticAssetsPresenter (which is the GWT code) which under the covers uses the FileUploadDialog class. To look at how this is persisted, check the StaticAssetCustomPersistenceHandler. This is what is responsible for actually obtaining the uploaded file (using UploadedFile.getUpload()) and doing something with it (persisting it, in this case). I imagine that you will have very similar functionality to creating a new static asset.