By David Crowther
Question:
How do you configure the Document Upload Tool for MapThat?
Answer:
The MapThat Drawing Tools now provide a Document Upload tool, which allows the user to upload any number of documents and images and attach them to any map object in your layers.
But how does the MapThat Administrator configure where the files are uploaded to? And how can we generate a download link for the users?
Initially, when the Document Upload options were added to the MapThat Drawing tools, this was previously controlled for each layer with options in the associated Information Bubbles:
Here you could define per layer which field is used to define the upload location and whether the uploaded file was a PDF document or an image. However, this restricted the user to only being able to upload 2 files.
Since the Document Upload tool has been updated to the new format, users can now upload as many documents and images as possible. The options to control the Upload and Download locations are now stored in the VE_WEBCONFIG table – accessible via the MapThat Admin Forms – Page Settings page –
• SERVER DOWNLOAD LOCATION = this is a URL that contains the server address and then a Virtual Folder that references the folder the images and files are stored in.
• SERVER UPLOAD LOCATION = this is the physical folder location on the server that the documents and images will be uploaded into.
SERVER UPLOAD LOCATION:
Choose a physical folder to store all images and documents. For example, F:\MapThatProjects\MapThatDocuments\UPLOADS
When the Document Upload tool runs an upload for a layer, the files will be uploaded under the root of the SERVER UPLOAD folder. The tool will then auto create a sub folder name based on the layer name and then store all images and documents with a unique name in that folder.
For example, here we have uploaded two photos called housingplan for the lcc_planning_apps layer.
• the system will auto create the sub folder name on the server based on the layer name
• it will upload (copy onto the server) the same image twice as the user chose it twice in the document upload tool
• but it has renamed each file and given each document a unique file name
SERVER DOWNLOAD LOCATION:
So that users can view and download any uploaded document or image, we need to construct a decorated URL which points to the server folder location and uses the document/image filename.
To do this, firstly we need to create a VIRTUAL FOLDER in IIS which points to the physical folder location (F:\MapThatProjects\MapThatDocuments\UPLOADS)… in this example we have called the IIS Virtual Folder MapThatDocs.
So, the decorated URL for these images will be –
https://try.dynamicmaps.co.uk/MapThatDocs/lcc_planning_apps/19042023102131_housing_plan.jpg
This URL is then activated when the user chooses the download file icon in the document upload tool.
Depending on your browser settings, the document or image will either be shown in a web browser tab….
… or the document/image will be auto downloaded to the users downloads folder for them to open, save, print or share.
Note – there is now a new MapThat control table which stores a reference for all the documents and images that are uploaded – VE_DOCUMENTS.
This table allows us to store the document type, actual file name, the layer it is associated to, the record ID in that layer and the date it was uploaded. A record is inserted each time an upload occurs and will also auto delete records when users delete documents or images within the Document Upload tool.
Comments
0 comments
Please sign in to leave a comment.