Upload/Download a file in a Matlab Web App

Hi everyone,
I have built a GUI with App Designer and complied it to a ctf file. One feature of the GUI is to select, read txt and create a txt file. Here an error occurs.
First clicking the right button, the web app opens a nice window where you can either drop the file or select it. The file is locally on the user's PC.
But after selecting the file, it shows the following error message:
Error occurred during upload/download for: example.txt
No permissions
Error using matlab.ui.control.internal.model.mixin.MultilineTextComponent/set.Text (line 49)
The Matlab Web App Server runs on linux machine and I gave all users write/read permissions to the folder (/local/MathWorks/webapps/R2020a/) containing the app.
But somehow that didn't change anything.
What do I have to do so that the App has the permission to upload/download files?
Thanks in advance
Christian

댓글 수: 6

J. Alex Lee
J. Alex Lee 2020년 8월 26일
are you first creating a file locally on the web app server before you attempt to serve it to the web client?
if so, are you using absolute paths to specify? if relative path, the web app might not be running where you think it is.
Christian Idzik
Christian Idzik 2020년 8월 26일
편집: Christian Idzik 2020년 8월 26일
No I didn't use a local file.
I am using [filen,pathn] = uigetfile('*.txt', 'Please select your txt file');
The aim is that the user of the web app can upload a file which then is checked and used for some calculations.
The questions is if the Web App Server has no permission to download it from the user's Pc or the Web App Server is not allowed to write/read files in a specific folder.
J. Alex Lee
J. Alex Lee 2020년 8월 27일
Ok so you're confirming that you get error upon only reading the remote file, not on creating it.
I think uigetfile does have to copy the file into some local folder, but I would have thought whatever location that is would r/w-able by default (e.g., the web app server session folder)...wish the error message gives you what folder it was attempting to use that generated the permissions error!
Christian Idzik
Christian Idzik 2020년 8월 27일
편집: Christian Idzik 2020년 8월 27일
Yes, I would have thought so too. Unfortunately, the specific folder is not in the error message.
Anyway, thanks!
J. Alex Lee
J. Alex Lee 2020년 8월 28일
yea, sorry i was no help...i've had some luck in the past trying to diagnose web server working path by outputting various paths when i encountered local write permission issues...but never encountered a problem with the result of uigetfile() itself (on a windows web server though).
My main learning was that the runtime directory is not the directory where the ctf file resides (whereas I believe for stand-alone executables, the working directory is wherever the .exe lives), and so trying to work with relative paths with deployed code is generally confusing.
is it possible the web app is using a system temporary directory like /tmp, that for some reason you have set to r-- or something?
no problem. ;)
The Matlab Web App Server runs on a linux server(opensuse)
that is a good idea, the question is where the system temorary directory is, I will do some try and error.

댓글을 달려면 로그인하십시오.

답변 (0개)

카테고리

도움말 센터File Exchange에서 MATLAB Web App Server에 대해 자세히 알아보기

제품

릴리스

R2020a

태그

질문:

2020년 8월 26일

댓글:

2020년 8월 31일

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!

Translated by