facebook

Download a file from internet and save it into local DB

💡
Our Forums Have Moved

For help with installation, bugs reports or feature requests, please head over to our new forums.
Genuitec Community on GitHub

  1. MobiOne Archive
  2.  > 
  3. Getting Help – General
Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #332312 Reply

    alonso100
    Member

    Hello,

    I´ve read many posts here about how to read records from a file and save it into a local database. I succeded in this task by using the following in the screen´s properties:

    form = ‘X’
    Form method = GET
    action type = URL
    URL = my URL
    Result type = data text (ajax)

    So, when I press the button Submit, application reads the information from the text file in my server and saves it in a database table that I create as the next step. So far so good.

    The problem is when I have to read 3 different files (.csv or .txt) from the internet. It would not be good to create 3 screens, press the checkbox Form and ask the user to press 3 different buttons for doing the same activity (download of file). Is there a way how to do this in the same screen ?? how do I feed the field URL dynamically ??

    Is there any other way to download files into the app ??

    Thanks.

    #332424

    Hi Alonso,

    At this time using $.ajax() is best approach.

    #332425

    alonso100
    Member

    Hello,

    Ok, I´ve learnt something new. For future request from any other programmer, this is the code:

      function fetch_file(){
        $.ajax({
          url: "http://myURL/myFile",
          type: "GET",
          success: function(data){
            processData(data); 
          },
          error: function(error){
            alert('Error when downloading the file (Code: '+error.code+')'); 
          }
        });
    }

    In data we have the information that was fetched and in function processData the information is processed.

Viewing 3 posts - 1 through 3 (of 3 total)
Reply To: Download a file from internet and save it into local DB

You must be logged in to post in the forum log in