(VIKTOR SDK 14.15 python 3.11)
Hi, I have an issue with ImageView: I simply want a user to upload an image via a FileField that is then shown in an ImageView tab.
This is my code in the Controller: (in Parametrization the FileField has attribute name = P_general_uploadimage)
@ImageView('Afbeelding', duration_guess=2)
def voorbeeldplaatje(self, params, **kwargs):
file_path = Path(__file__).parent / params.P_general_uploadimage.filename
return ImageResult.from_path(file_path)
Uploading a file that is located in the design folder works fine, but uploading a file from a generic location gives the following error:
ValueError: path '/home/user/src/app/design/image.png' is not a valid file-path.
How should I correctly specify the path to the uploaded file?