cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Community Tip - You can subscribe to a forum, label or individual post and receive email notifications when someone posts a new topic or reply. Learn more! X

Getting error "Message ::Invalid child path: Child path failed validation" while uploading file.

AV_10867476
7-Bedrock

Getting error "Message ::Invalid child path: Child path failed validation" while uploading file.

I have created a mashup which used the file upload widget to display an image using the image widget, i have created a service, which takes parameters from the file upload widget and then supplies the result to the image widget which is an image link.

 

1 ACCEPTED SOLUTION

Accepted Solutions

Correct.  You can either copy that link format and put it together with string concatenation, or you can programatically call that GetFileListingWithLinks service to get the correct URL for that image.

 

-- Nick

View solution in original post

13 REPLIES 13

@AV_10867476 ,

 

It's not necessary to create the media entity to show your image in an image widget.  You can create your url like this:

/Thingworx/FileRepositories/<path to image>/myImage.png

 

Bind that relative url to your image widget and it should show it.

 

- Nick

 

Thanks for the response Nick, so as i understand the path has to be changed like you have mentioned  so i directly assigned the result

It looks like 1.1.png is in the path twice.  It will look something like this:

/Thingworx/FileRepositories/MyFileRepository/1.1.png

 

Did you create a new Repository Thing to put your images in or are they going in the System Repository?

 

I would suggest navigating to the File Repository thing and running the service GetFileListingWithLinks.  That will give you the correct url format.

Didn't create any file repository actually, what all i did was create a thing for supporting the mashup widgets for achieving the functionality and followed the solution 2 in this article : https://www.ptc.com/en/support/article/CS214785

 

I am not sure about how this part you mentioned "navigating to the File Repository thing" will be implemented, should i use the service you mentioned above "GetFileListingWithLinks" on the service which i created?

 

edit: did something like this :

let result = Things["ImgRepThing"].GetFileListingWithLinks({
    path: imagePath /* STRING */,
    nameMask: imageName /* STRING */
});
got the error GetimageInput.Message: : Directory does not exist: /#123.png - See Script Error Log for more details.

Solution 1 and Solution 2 both involve creating a Repository Thing, which is a Thing with the File Repository base Template.  When you added your Upload widget in your mashup, there should be an option to point it to that repository.  After an image is uploaded to that repo, you should be able to look at the File Repository thing you created and run the GetFileListingWithLinks service.  The output of that service will show you the correct format of link you should be outputting from your service.

 

- Nick 

Yes i have used the template you mentioned while creating a thing, also i checked in the properties that it is currently pointed to the system repository here and i have changed it to the repo thing which i am using.

  

Now:
1. Upload an image using that widget

2. Go to the Repository Thing you created and run the GetFileListingWithLinks service

3. Use that url format when you bind it to your image widget.  

 

 

So i uploaded an image in the mashup runtime, then went to the thing and ran the GetFileListingWithLinks service but got some error the file below is the one i had uploaded 

Leave the path and nameMask as the defaults and just run the service.  That will show you all the files

yes got the format of the files so i think i just have to set the result 

 

 

Correct.  You can either copy that link format and put it together with string concatenation, or you can programatically call that GetFileListingWithLinks service to get the correct URL for that image.

 

-- Nick

Thanks, it works now!

Good to hear.  Please 'Accept as Solution' so others know that the issue is closed.

Top Tags