19
Views
7
Comments
'Empty path name is not legal' when using Upload widget.
Discussion
 I'm trying to upload files using upload widget. I've put a button which send information to the server.

But, after choose a file, when I click on the button I get the message "Empty path name is not legal.".

The exception happens when I use the FileUpload\FileUpload_ReadContent action inside the destination action of the button.
mpty path name is not l
2016-04-22 00-29-45
Nuno Reis
 
MVP
What are you trying to do you the file?
You need to use the binary from the Upload widget somehow.
UserImage.jpg
Natanael Osorio
 It's a text file.

I need to extract the text content to do something like to show in a view.

Perhaps I could store the file to avoid upload the same file every time.
2016-04-22 00-29-45
Nuno Reis
 
MVP
Avoid the upload? If the information is always the same, you shouldn't use a file at all! That kind of info should already be in the server.
UserImage.jpg
Natanael Osorio
I´ve tried to put the file in resources folder before, but I cannot retrieve it. It´s a XML file.  This file is for test purposes. 

The file name is teste.xml. In the preparation of the webscreen I tried to to retrieve the file content using File_ReadText (the path is "Resources.teste_xml") but I got an Exception.

The exception:

"Access to the path 'c:\windows\system32\inetsrv\teste.xml' is denied."

In the webpage appears the following message:
Internal Error
 
Error:
Access to the path 'c:\windows\system32\inetsrv\Resources.teste_xml' is denied.

An internal error occurred and was logged.
Please try again later or contact the administration team.

Sorry for any inconvenience.

Press here to continue

2016-04-22 00-29-45
Nuno Reis
 
MVP
File_ReadText is the right function and resources seems a good ideia, but you can't open files from that directory. They are protected.

Try to use a folder far away from system files. If you have a d: drive, use it. There you can write and read as you want.
UserImage.jpg
Natanael Osorio
I think 'c:\windows\system32\inetsrv\' is a Outsystems server directory. It´s not in my local computer.

How could I put the file in other directory and retrieve it?


2016-04-22 00-29-45
Nuno Reis
 
MVP
If you are using the Personal Environment, you can't access any folder.
You can only write to database and so you must upload and save to database as binary. The Forum and Forge have several examples.

Use the Upload widget, that will give you the file as a Binary object.
From there, you can put it into the database with an Entity with a binary attribute,
and later get the binary from database and work it with several of the File functions.
Community GuidelinesBe kind and respectful, give credit to the original source of content, and search for duplicates before posting.