You need to sign in to do that
Don't have an account?
In Apex, Retrieve File Names from Static Resource Zip File
I have an application where the user creates a zip file of various images to be used on a Sites page, and then loads this as Static Resource.
Right now, to use the images, the user has to enter the exact, complete name (case matters) of the file name in the zip file to incorporate an image on the Sites Page. These specifications are maintained in a separate object.
What I would like to do is present the user with a picklist of the files in the static resource. This would eliminate a lot of errors.
But there does not seem to be a way to do this in Apex.
Any ideas? Anyone?
If it's possible for the user to make a list of the image names and load it with the pictures you can build a list with some logic like this. This takes a csv
You can build a selectoptions list based on the returned string array and then do your static resource query for the image based on the filename picked from the selectoptions. I'm not sure if its possible to get into the zip file and extract the filenames
Does that work?
I had thought about something like this.
But I have no trust of users. I prefer, whenever possible, to limit the users to point and click and let the software handle everything else.
Actually, the more I investigated, I am probably going to have to stop using StaticResource for my particular application because end-user maintenance is tedious at best. The static resource itself has to be hard coded by name in the visualforce page. There is no way to pass the static resource as a variable.