IMPORT TXT FILE and add its content to a listbox line by line... / Importar un archivo de texto y cargarlo en un listbox - Forum

Forum Navigation
You need to log in to create posts and topics.

IMPORT TXT FILE and add its content to a listbox line by line... / Importar un archivo de texto y cargarlo en un listbox

Page 1 of 2Next

@gaev

Friend once again I have to resort to the guru of this forum, you will see I cannot do the following

I have a page with a listbox and in the root a text file called 01.txt that contains 8 lines

FILE 01.txt

16:00 | DISPONIBLE
17:00 | DISPONIBLE
18:00 | DISPONIBLE
19:00 | DISPONIBLE
20:00 | DISPONIBLE
21:00 | DISPONIBLE
22:00 | DISPONIBLE
23:00 | DISPONIBLE

I need to read that file and load it in the listbox but load it line by line not all the time

add and delete I have the formula but I can't read and load the file.

and Finally I need to be able to export back to file 01 the file if it is modified or changed....

I am attaching the file in question to see if you can give me a hand.

thousand thousand thanks

ESPAÑOL

no logro hacer lo siguiente

Tengo una pagina con un listbox y en el raiz un archivo de texto llamado 01.txt que contiene 8 lineas

Necesito leer ese archivo y que se cargue en el listbox pero que se cargue linea por linea no todo seguido

agregar y eliminar tengo la formula pero no logro leer y cargar el archivo.

y Finalmente necesito poder exportar nuevamente al archivo 01 el archivo si se modifica o cambia....

te adjunto el archivo en cuestion a ver si me puedes dar una manito.

Mil mil gracias

@joferar333

I have a page with a listbox and in the root a text file called 01.txt that contains 8 lines

FILE 01.txt

16:00 | DISPONIBLE
17:00 | DISPONIBLE
18:00 | DISPONIBLE
19:00 | DISPONIBLE
20:00 | DISPONIBLE
21:00 | DISPONIBLE
22:00 | DISPONIBLE
23:00 | DISPONIBLE

I am attaching the file in question to see if you can give me a hand.

I think you forgot to attach the file; however, just place the file on your server space (make sure it is going to be readable by anybody (otherwise CORS restrictions will not allow the app to read the file) ... and provide the URL of this file.

I need to read that file and load it in the listbox but load it line by line not all the time

I am not sure what you mean by "load it in the listbox but load it line by line not all the time" (perhaps something is being lost in translation).

Do you want your Listbox to show items with labels 16:00 to 23:00, and when the user selects the time, the value after the | (i.e. DISPONIBLE in your example) is returned as the item selection ?

There was a recent post (started by @smartmedia) where details of a similar nature were discussed. briefly ...

- the contents of the file are loaded into a single variable
- the variable contents are then parsed (split into an array where each item is a line from your file)

and Finally I need to be able to export back to file 01 the file if it is modified or changed....

I am not clear what/how the changes would be made.

It is generally a lot more complex to write back to files on your server; probably require use of PHP, which I am not experienced with.

If you can provide ...

- the link to a readable text file
- answers to my queries, then I can look into it.

@gaev

Here is the link to the file I want to upload...

https://globaldima.com/turnos/01.txt

when loading the content of this file I want the data it contains line by line to be displayed in a list box (line by line)

and the way to be able to re-record that list box with the same name 01.txt overwriting the initial content

Don't worry about the rest, I know how to develop it, I'm missing this

@joferar333

In trying to develop the App for you, this command ...

FileToVar "https://globaldima.com/turnos/01.txt" [loadHere]

... caused the Browser to issue this error message ...

Access to XMLHttpRequest at 'https://globaldima.com/turnos/01.txt' from origin 'null' has been blocked by CORS policy: No 'Access-Control-Allow-Origin' header is present on the requested resource.
Failed to load resource: net::ERR_FAILED

As I mentioned in an earlier post, you must setup your server side environment to allow access to this file from everywhere.

If you need to know how, perhaps @smartmedia can assist you; last week, he setup his text file for the App that I was assisting him with here ... https://visualneo.com/forum/topic/load-set-of-variables-from-text-file

Let me know when this is done.

@gaev

Friend, I've been watching videos for hours, searching the forum and I can't get a file to be written locally or published on my server. I'll give you the source, it only contains a button that when pressed must write a file to see if I can get out of this trouble and I can write...
in this example it only writes the file.. but I would need the file to be written inside a folder (https://globaldima/turnos/16) but I can't do it...
Uploaded files:
  • You need to login to have access to uploads.

Hi..

In order to upload a file you need to setup your config.php file first.

$fileAlias[0]="*.jpg";
$fileNames[0]="*.jpg";
$filePermissions[0]="rw";
$fileMaxUserLevel[0]=-1;

$fileAlias[1]="*.png";
$fileNames[1]="*.png";
$filePermissions[1]="rw";
$fileMaxUserLevel[1]=-1;

$fileAlias[2]="*.pdf";
$fileNames[2]="*.pdf";
$filePermissions[2]="rw";
$fileMaxUserLevel[2]=-1;

The above example give you the ability to upload files with extension (jpg - png -  pdf) If you want to upload only *.txt files add in your config.php the following:

$fileAlias[0]="*.txt";
$fileNames[0]="*.txt";
$filePermissions[0]="rw";
$fileMaxUserLevel[0]=-1;

put the config.php file in your server root directiory where your index.html file is.

Then you can try the

neoPhpFileWrite "order.txt" "hello" verdadero ""

Tell us if that did the work.

@joferar333

I am sorry I can't help you because I do not have any experience working with neoPhpFileWrite (or any other) command that writes back to a file on the server.

Besides, you will run into the same CORS issue unless you have resolved the issue that I pointed out in my last post; did you manage to resolve it ?

smartmedia has reacted to this post.
smartmedia

Dear @Gaev I really appreciate your help from the bottom of my heart.

Unfortunately I can't get it to write. (test local and publish server)

I have solved the issue of Cors by the technical support of my server
Still there is no way I can write a text file...

I attach the source and I also give you an access that I set up for you on the server where the compiled example is published.

your access ftp

http://ftp.alejandrovalenti.com

User = gaev@alejandrovalenti.com
pass = Gaev$123456789
port = 9021

I have published the source at this address: https://alejandrovalenti.com/pelu/

Uploaded files:
  • You need to login to have access to uploads.

thanks @smartmedia !!!!

@luishp

estimado Luis,  tengo que pedirte un gran favor personal, se que no estas para andar revisando codigos etc... pero he agotado todos los medios a mi alcance, tutoriales, post e incluso la ayuda de gaev y mada parece funcionar.

 

Intento escribir un archivo de texto usando el siguiente comando

neoPhpFileWrite "order.txt" "hello" verdadero ""

He seguido todos los pasos pero no logro que se escriba ni usando el phpserver local ni publicandolo ...
el fuente es muy simple solo hay un boton que ejecuta ese comando y que deberia como resultado escribir el archivo pero no hay caso

He desistalado por completo el programa y lo reinstale de cero pero nada.

No es un problema de cors porque eso ya esta solucionado me lo habilito el soporte tecnico de mi servidor pero aun asi no hay forma que escriba nada
Tambien he verificado y la funcion fopen esta habilitada en el servidor.

Te pediria si puedes utilizar el post que arriba le acabo de enviar a Gaev donde esta el fuente, y el compilado publicado y tambien un acceso ftp

La verdad te voy a estar eternamente agradecido porque ya no se que hacer...

 

Saludos Cordiales

ALEJANDRO

p/d Voy a publicar ahora para compartir como se habilita el Cors en un determinado dominio para los que se les presente este problema puedan encontrar la forma de solucionarlo rapidamente...

@joferar333 por favor sigue este tutorial con un proyecto desde cero y dime si consigues hacerlo funcionar:

ok ahora lo intento tanto en local como publicandolo a mi servidor.

lo que muestras en este tutorial esta dentro de los ejemplos porque ahi hay una rutina que no se muestra me podrias decir cual de los ejemplos de php es, igualmente voy a ir cargando uno a uno y lo voy a hacer tal como lo pides

Te comentare

Gracias mil ya que esto me esta volviendo loco

 

@joferar333

I have solved the issue of Cors by the technical support of my server

I still get CORS errors when I try to load the file "https://globaldima.com/turnos/01.txt"; the same command to fetch the file setup by @smartmedia works just fine.

Still there is no way I can write a text file...

As I mentioned before, I have no experience in this area; so I can't help you.

your access ftp

I have no clue what ftp access will do to resolve your requirement; please remove this access, otherwise anyone can sign in using these credentials which you have made available to the whole world.

@Luishp

No hay caso... segui todos los pasos del video...

ejecutandolo en local host en la barra inferior donde aparece la respuesta del servidor me sale permiso denegado

lo subi y arriba directamente no da ningun mensaje pero no funciona

Fijate

https://globaldima.com/2/

la  foto corresponde a la ejecucion en el server local de php

 

 

No entiendo porque no funciona....

Uploaded files:
  • You need to login to have access to uploads.

@joferar333 al ejecutar la aplicación en tu servidor aparece en la Consola un error del tipo: 500 Internal Server Error
¿Que versión de PHP tiene instalada?
En local, ¿utilizas neoPhp Server o algún otro servidor web?

@luishp

Buen día luis. En el local uso el servidor de NeoServer siguiendo paso a paso el video.

Con relacion al servidor que me dices que te tira error 500 ya reviso y me pongo en contacto con el soporte

La version que tengo es php 8.0

 

La verdad que no entiendo porque me pasa esto llevo 3 dias sin poder lograr escribir un simple archivo txt ...

Necesito me reproduzcas que pasos das para el error, yo acabo de entrar y la aplicacion se muestra sin ningun error...

https://globaldima.com/2/#!/Home

Si les digo que tira error 500 y ellos van a esa url veran que funciona no entiendo...

acabo de reproducir la consola a mi no me da error 500 lo que da es que los archivos de neo JS no funcionan....

 

DevTools failed to load source map: Could not load content for chrome-extension://gighmmpiobklfepjocnamgkkbiglidom/browser-polyfill.js.map: Error del sistema: net::ERR_FILE_NOT_FOUND
DevTools failed to load source map: Could not load content for https://globaldima.com/2/js/angular-sanitize.min.js.map: Error HTTP: código de estado 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for https://globaldima.com/2/js/angular-animate.min.js.map: Error HTTP: código de estado 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for https://globaldima.com/2/css/bootstrap.min.css.map: Error HTTP: código de estado 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for https://globaldima.com/2/js/angular.min.js.map: Error HTTP: código de estado 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for https://globaldima.com/2/js/angular-touch.min.js.map: Error HTTP: código de estado 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE
DevTools failed to load source map: Could not load content for https://globaldima.com/2/js/angular-route.min.js.map: Error HTTP: código de estado 404, net::ERR_HTTP_RESPONSE_CODE_FAILURE

Mirando bien me doy cuenta que en la carpeta Js los nombres no coinciden a todos les falta el .map

Te amplio: probe compilar como exe directamente no la arranca ni funciona

probe en compilarla como crhome, en el local no ejecuta, me dice que local rechazo la conexion

 

como referencia te pego el archivo .htcces  de mi dominio globaldima con el CORS habilitado

 

----------------------------------------------------------------------------------------------------------------

Header set Access-Control-Allow-Origin "*"
Header set Access-Control-Allow-Methods "GET, POST, OPTIONS, PUT, DELETE"
Header set Access-Control-Allow-Headers "Content-Type, Authorization, X-Requested-With"

# WebSite X5 - Start Code [do not edit]

ErrorDocument 404 /404.php

# WebSite X5 - End Code

 

# php -- BEGIN cPanel-generated handler, do not edit
# Set the “ea-php80” package as the default “PHP” programming language.
<IfModule mime_module>
AddHandler application/x-httpd-ea-php80 .php .php8 .phtml
</IfModule>
# php -- END cPanel-generated handler, do not edit

# BEGIN cPanel-generated php ini directives, do not edit
# Manual editing of this file may result in unexpected behavior.
# To make changes to this file, use the cPanel MultiPHP INI Editor (Home >> Software >> MultiPHP INI Editor)
# For more information, read our documentation (https://go.cpanel.net/EA4ModifyINI)
<IfModule php8_module>
php_flag display_errors On
php_value max_execution_time 30
php_value max_input_time 60
php_value max_input_vars 1000
php_value memory_limit 512M
php_value post_max_size 64M
php_value session.gc_maxlifetime 1440
php_value session.save_path "/var/cpanel/php/sessions/ea-php80"
php_value upload_max_filesize 64M
php_flag zlib.output_compression Off
</IfModule>
<IfModule lsapi_module>
php_flag display_errors On
php_value max_execution_time 30
php_value max_input_time 60
php_value max_input_vars 1000
php_value memory_limit 512M
php_value post_max_size 64M
php_value session.gc_maxlifetime 1440
php_value session.save_path "/var/cpanel/php/sessions/ea-php80"
php_value upload_max_filesize 64M
php_flag zlib.output_compression Off
</IfModule>
# END cPanel-generated php ini directives, do not edit

----------------------------------------------------------------------------------------------

ARCHIVO PHP.INI en el root del dominio

allow_url_fopen = On
display_errors = On
enable_dl = On
file_uploads = On
max_execution_time = 30
max_input_time = 60
max_input_vars = 1000
memory_limit = 512M
post_max_size = 64M
session.gc_maxlifetime = 1440
session.save_path = "/var/cpanel/php/sessions/ea-php80"
upload_max_filesize = 64M
zlib.output_compression = Off

B

Uploaded files:
  • You need to login to have access to uploads.

RESPUESTA DEL ANALISIS DEL SOPORTE DE MI SERVIDOR

 

Estimado Alejandro, le paso a comentar que hemos revisado y analizado el contenido web vía log_error así como también realizamos diferentes pruebas sobre las versiones php y el error se mantuvo.
Se aplicó un ajuste sobre el archivo .htaccess renombrándolo y el error reportado cambió según la imagen que adjunto.

De todas formas al ser una api externa no tenemos mayores datos de el motivo por el cual ocurre este error, por lo que deberán revisarlo con su programador/desarrollador ya que desde el sistema y servidor que brindamos nosotros no replicamos fallas generales.
Por último, mas allá del error 500 reportado no posee relación con la conexión a la base de datos, lo cual es preciso ya que el string de conexión está vacío.

En fin, como mencionamos anteriormente, al ser una app externa, no podemos asesorarlo en detalle ya que no damos asistencia sobre herramientas o complementos ajenos a Nuthost.

Un cordial saludo.

Agustín Luiso | Asistente de Cuentas
Atención al Cliente

NUTHOST Cloud Hosting
0810.999.4678 (HOST) | nuthost.com | info@nuthost.com
LinkedIn - Instagram - Twitter - Facebook - Youtube

Uploaded files:
  • You need to login to have access to uploads.

Hi..

My friend, did you setup and upload the config.php on your server ? If you didn't you cannot upload any files regadless of your server. Please  respond to that, just to be sure that you have follow all the right steps.

Yes, friend @starmedia I have even attached the confi.php and the neofunctions file, still nothing... there is no case, there are errors that do not depend on the server, I think the compilation is generating badly, the issue is that there is no way I can do it work and I confess that I am disappointed that a function as stupid as being able to write a file and then be able to raise it in a variable becomes so complicated, in this case it is the example that Luis asked me to do does not work either..


@luishp

He logrado descrubir el error en el server local.

el tema es que esta instalado en el disco C y por lo visto no permite escribir .. de ahi el permiso denegado...
baje e instale xamp en el disco d
corri la aplicacion y si bien grabo el archivo da error fijate las fotos...
ahora al cargar tambien da error...
y siguen apareciendo en la consola errores de los archivos de la aplicacion

Tambien da error en variables y no me doy cuenta cual es ese error

te vuelvo a adjuntar los archivos config.php y neofunciones a ver si me puedes descubrir donde esta el error.

De todas formas ten en en cuenta que lo que intento hacer es poder ejecutar y que funcione el poder escribir varios archivos con diferentes nombres y la extencion txt en el servidor y luego poder tomarlos para convertirlos en variables de contenido

Como hago para instalar neoserver en el disco D??? para solucionar el tema de permisos

Por favor mira las imagenes adjuntas

 

 

 

Uploaded files:
  • You need to login to have access to uploads.

@luishp

Ahora si ya no entiendo nada y no dejo de sorprenderme

probe otro ejemplo lo compile y lo ejecute en neoserver en el disco C

Simple FileSystem API Text Editor and Test App - VisualNEO Web

y funciona perfecto lee y escribe sin problemas-

Igualmente revise la consola y tira los mismos errores que el anterior ejemplo con los archivos de recustos js.

La verdad ya no entiendo nada..

Hay alguna forma de utilizar File system para poder escribir un archivo y luego leerlo pero que no habra cuadros de busqueda? la verdad que me tiene parado y hasta de mal humor este tema, quede a medio camino de una app que tengo en desarrollo y que debido a esto no puedo continuar

La publique en el servidor remoto y tambien funciona perfecta

https://globaldima.com/3

Page 1 of 2Next