This system has a global container field being used for uploading documents & images. The reason for the global is so that the file can be renamed to match a naming structure used by the client. The file is categorized by a couple of fields and this generates the new file name. When an upload button is pressed the fields contents are exported to the local Temp directory and then re-imported into the correct place with the new file name.
When the re-import happens the file loses its preview. Not sure why. Both containers (global field and the main global) are both set for Image optimization.
Any suggestions as to why the preview would get lost?
Instead of exporting the field contents I used the Base64Encode and Base64Decode functions. The decode allows me to specify a filename.