How to access a local file in webcomponent.

Forum to discuss the new web client version of Servoy.

How to access a local file in webcomponent.

Postby ashutoslenka426 » Wed Sep 27, 2017 2:01 pm

Hi All ,

I have a webcomponent . As the webcomponent runs on the client side . How to access the a file with this path "C:\Users\ASHUTO~1.LEN\AppData\Local\Temp\1svy6635317187690402265.jpg"

In my case this is not visible in the ngclient . But visible in the designer . How this can be made possible ?
AL
ashutoslenka426
 
Posts: 295
Joined: Thu Jan 26, 2012 3:38 pm

Re: How to access a local file in webcomponent.

Postby Harjo » Wed Sep 27, 2017 3:56 pm

Not possible,

an NGclient (or any websolution) does not heave direct access to your local file system!
Harjo Kompagnie
ServoyCamp
Servoy Certified Developer
Servoy Valued Professional
SAN Developer
Harjo
 
Posts: 4321
Joined: Fri Apr 25, 2003 11:42 pm
Location: DEN HAM OV, The Netherlands

Re: How to access a local file in webcomponent.

Postby ashutoslenka426 » Thu Sep 28, 2017 6:50 am

How can we access the file ? . Do we need to stream files to server ? . Do we need to move to default file upload location ? . But still I cannot access it .

I am giving a example server path "C:\ServoyFinal\Installation\application_server\server\webapps\ROOT\uploads\Delete_icon7061898935877499997" . But this is not working .

Can you please provide an example.

Please provide some suggestions.
AL
ashutoslenka426
 
Posts: 295
Joined: Thu Jan 26, 2012 3:38 pm

Re: How to access a local file in webcomponent.

Postby ashutoslenka426 » Thu Sep 28, 2017 7:36 am

Hi ,

I finally got that . we have to access that using application.getServerURL.
AL
ashutoslenka426
 
Posts: 295
Joined: Thu Jan 26, 2012 3:38 pm

Re: How to access a local file in webcomponent.

Postby patrick » Thu Sep 28, 2017 9:17 am

Again, from within the browser you cannot read files on the user's hard drive. Imagine a website could do that!?

Not sure what you mean with getServerUrl? That will never do anything useful in a real browser (it might work in developer, because there you sit on the server).

When you want a file from the user's hard drive, the user has to select that file. You can't just read it. This works only in smart client.

Have a look at https://wiki.servoy.com/display/DOCS/file
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: How to access a local file in webcomponent.

Postby ashutoslenka426 » Thu Sep 28, 2017 9:29 am

Patrick I mean to say we have to move the file to the server . Then we can access it .
AL
ashutoslenka426
 
Posts: 295
Joined: Thu Jan 26, 2012 3:38 pm

Re: How to access a local file in webcomponent.

Postby patrick » Thu Sep 28, 2017 9:36 am

If you look at the wiki you see that after a file upload your callback method receives the file as argument. No need to deal with the server hard drive at this point.
Patrick Ruhsert
Servoy DACH
patrick
 
Posts: 3703
Joined: Wed Jun 11, 2003 10:33 am
Location: Munich, Germany

Re: How to access a local file in webcomponent.

Postby ashutoslenka426 » Thu Sep 28, 2017 10:20 am

actually in our case we are using devexpress file uploader , not the default Servoy one . and we want to show the preview of the file before it is uploaded.
AL
ashutoslenka426
 
Posts: 295
Joined: Thu Jan 26, 2012 3:38 pm


Return to Servoy NGClient

Who is online

Users browsing this forum: No registered users and 16 guests