Skip to main content

Hey,

I have a Server App setup using my FME server where it allows users to select a location on an interactive map, and enter details into a text box.

 

I would love to expand this to also allow the user to upload n images to be associated with this form submission. I have been looking for a tutorial for guidance, but they all seem to be setup around the user submitting a document like a CSV with data to be extracted and processed, mine is simpler than that, I just want to 'move' the images to a resource directory for future reference, but this 'move' process is where I get stuck.

 

EDIT:

So after stepping away from my computer and coming back I think I have worked out the process, but the output file is 'corrupt' and the image cannot be viewed. Is there anything specific I need to have setup so that files are output exactly as they are uploaded?

image 

image

I've used a JPG reader / writer to do something like this (of course the image uploaded has to be a JPG for this to work, but I suppose you can do Generic to Generic as well)

 

In your situation I think you can use a FeatureReader after your FilenamePartExtractor to actually read the file being referenced in the parameter. Another avenue to explore is using a FileCopy writer to simply copy the file, rather than reading it.


I agree with redgeographics (Partner)​ , using the JPG reader/writers works well. I have an app that allows the user to collect three photos. There is a published parameter for each photo, which flows into a separate FeatureReader for each photo and writes to a separate JPG writer for each photo. It looks like you are close, but maybe submitting multiple files at once is corrupting the output?


I've used a JPG reader / writer to do something like this (of course the image uploaded has to be a JPG for this to work, but I suppose you can do Generic to Generic as well)

 

In your situation I think you can use a FeatureReader after your FilenamePartExtractor to actually read the file being referenced in the parameter. Another avenue to explore is using a FileCopy writer to simply copy the file, rather than reading it.

@Hans van der Maarel​ Can you explain a bit?

I have a similar need. I have a specific FileUse but not a specific fileformat.

( e.g. I want the user to upload an agreement. But it could be pdf,doc,txt,xlsx, etc.)

I would only need the reader if i wanted to do something with the file right?

If I just wanted to turn an upload into a filecopy to a specific location. I could just get the upload file name to use as the filename and then place it where i wanted with the filecopier. and build a destination from some parameters.

You don't have any examples do you?


Reply