Static resources breaks in Visual Force Page rendered as PDF after changing a file inside the zip and re-uploading
I downloaded a working Static Resource used by a VF page and change an image, compressed the folder and re-upload again and ended-up with a not working VF page. None of the images were loading and the css not being applied.
I compared with other static resources and noticed a difference in the MIME type of file uploaded file.
The type of my re-uploaded zip file shows as "application/zip" vs the others showing as "application/x-zip-compressed". After many, but many posts reading, I realised this is not the root of the problem
Solution: When compressing the file, the individual folders inside the zip needs to be selected and compressed; whereas compressing the whole folder adds an extra folder to the path, breaking the link to the static resource from the VF page, eg.:
- "myStaticResources.zip/myStaticResources/styles/style.css" instead of
- "myStaticResources.zip/styles/style.css"
So the formula in the VF page: "{!URLFOR($Resource.myStaticResources, '/styles/style.css')}" won't work
#VfPage #Host Static Resource #Upload Files #Download Pdf #Visualforce #VisualForce Page #Zip File
OMG. THANK YOU.
After hours of troubleshooting this, finally found your tip. I was zipping up the folder also, and getting 404, pulling my hair out. lol. finally fixed.