Files & Folders on a secure server

Moderators: LCNeil, heatherlaine, kevinmiller, elanorb

Post Reply
pTom
Posts: 40
Joined: Wed Sep 18, 2013 10:44 pm

Files & Folders on a secure server

Post by pTom » Thu Oct 10, 2013 10:39 pm

Hi all

I am using a secure server on GoDaddy to host my files. Therefore, in order to give access to my files, I need to create a "public link" to put into live code. Here is my question:
Option #1: Do I use the public link of the folder with the "/filename" attached on the end of the link? If so, do I include the "https://"? If not, what should the format be?
Option #2: Do I use the public link of the file itself?

I don't like Option #2 because it creates more problems when uploading the file and autogenerating the name of the file. If at all possible, I would much rather use option #1. But I am unclear as to how to format name of the link.

Also, do I still use - url ("file:" & "filename") - when referencing the file or something else?

Thanks!

Tom

pTom
Posts: 40
Joined: Wed Sep 18, 2013 10:44 pm

Re: Files & Folders on a secure server

Post by pTom » Thu Oct 10, 2013 11:47 pm

Just to make sure you know what I am doing,I am using a text file on the secure server to populate my data grid. Her is my code:

put url "https://name of secure server public link/filename.txt" into tData
set the itemDel to tab

repeat with x=1 to the number of lines in tData
put item 1 of line x of tData into tDataArray[x]["Month"]
put item 2 of line x of tData into tDataArray[x]["Date"]
put item 3 of line x of tData into tDataArray[x]["Book"]
put item 4 of line x of tData into tDataArray[x]["Description"]
end repeat
set the dgData of group "displayMenu" to tDataArray

When I had the same file located in my computer's documents file, the data grid populated fine. Now, however, I am getting a "404" message that the file was not found.

If I paste the same link in a web browser, I will receive the file downloaded to me automatically.

pTom
Posts: 40
Joined: Wed Sep 18, 2013 10:44 pm

Re: Files & Folders on a secure server

Post by pTom » Mon Oct 14, 2013 3:22 pm

Ok, not sure if anyone else is reading this, but just in case, I will post my solution which also comes with another problem:
-After speaking with several people at GoDaddy, I finally spoke with someone who told me that online storage at GoDaddy can't be used for accessible storage like I was doing (other people at GoDaddy said that it could). I need a server, not storage! Haha, good lesson

So, I signed up for On-Rev's server and am still encountering a problem. I used the code in the previous posts with the proper links and the folders (that hold the text file) in the "world" portion of the storage. However, only the first line of my text file is populating the first row of the data grid. Weird

I can't figure out why the entire text file isn't populating all of the appropriate rows of the data grid...ideas?

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Files & Folders on a secure server

Post by LCNeil » Mon Oct 14, 2013 10:08 pm

Hi Tom,

Apologies for the delayed reponse

Do you have an example text file on your go daddy storage that you could provide a link to?. If the text file is accessible, say via a web browser, then there should be no real reason that it cannot be accessed via LiveCode.

Also, could you supply a link to the text file on your on-rev storage as this will allow us to try and replicate the issue you are experiencing.

Kind Regards,

Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
-

pTom
Posts: 40
Joined: Wed Sep 18, 2013 10:44 pm

Re: Files & Folders on a secure server

Post by pTom » Tue Oct 15, 2013 3:45 pm

Hi Neil

Attached is the file. Like I mentioned the first line shows up properly in the row (I made a custom template) in my data grid form (not a table).

Here is my code:

Code: Select all

set the dgData of group "displayMenu" to empty
      
      put url "urllinktofile" into tData
      set the itemDel to tab
      
      repeat with x=1 to the number of lines in tData
         put item 1 of line x of tData into tDataArray[x]["Month"]
         put item 2 of line x of tData into tDataArray[x]["Date"]
         put item 3 of line x of tData into tDataArray[x]["Book"]
         put item 4 of line x of tData into tDataArray[x]["Description"]
      end repeat
      set the dgData of group "displayMenu" to tDataArray
The url above is the correct url I am trying to connect to...

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Files & Folders on a secure server

Post by LCNeil » Tue Oct 15, 2013 4:58 pm

Hi Tom,

Can I just double check that file attached to the reply ok as I can't seem to see it?

If you have trouble attaching then please forward the file to my email- neil@runrev.com

In regards to the url links, I cant seem to see them either. Please post them in a new reply and I will look into them also.

Kind Regards,

Neil Roger

--
RunRev Support Team ~ http://www.runrev.com
--

pTom
Posts: 40
Joined: Wed Sep 18, 2013 10:44 pm

Re: Files & Folders on a secure server

Post by pTom » Tue Oct 15, 2013 6:09 pm

I sent the file to you via email. I didn't include the url because the forum said I don't have permission to do so. I will send that via email as well. Thanks!

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Files & Folders on a secure server

Post by LCNeil » Wed Oct 16, 2013 10:48 am

Hi Tom,

Thank for supplying the test link and text file.

I managed to replicate the issue you were experiencing and it would seem that it was a text file formatting issue that was causing only a single line to be populated in the datagrid.

If you visit the link to your text file (http://lifetree.on-rev.com/3M4G/3M4GInf ... tArray.txt) and view the page source you will notice that it is displayed as one single line of text. This explains why only one line is being generated on the datagrid. By default a carriage return is what the default lineDelimiter is set too.

As this is the case, I recreated your text file in a new plain text document and uploaded it to here http://techsupport.on-rev.com/Untitled.txt. When this is used, your datagrid will populate as expected.

I have attached this updated text file for your reference.

Kind Regards,

Neil Roger

--
RunRev Support Team ~ http://www.runrev.com
--

pTom
Posts: 40
Joined: Wed Sep 18, 2013 10:44 pm

Re: Files & Folders on a secure server

Post by pTom » Wed Oct 16, 2013 4:35 pm

Thanks, Neil! I will look at it now.

The immediate question comes to mind, why would the file have changed to read as one line? When I used this file stored on my computer (in my Documents folder), it read just fine. However, after I uploaded it to my on-rev account, that is when it stopped reading properly. Don't understand that...

pTom
Posts: 40
Joined: Wed Sep 18, 2013 10:44 pm

Re: Files & Folders on a secure server

Post by pTom » Wed Oct 16, 2013 4:40 pm

Ok, I looked at your file and my file. When I open them up in Safari, they both display the same. In fact they look just like my original text file still on my computer. So, I am confused. I don't understand where you are seeing that the text file on my hosting is being displayed as a single line.

I want to understand so I can see this in the future if it happens again.

Look forward to hearing form you!

pTom
Posts: 40
Joined: Wed Sep 18, 2013 10:44 pm

Re: Files & Folders on a secure server

Post by pTom » Wed Oct 16, 2013 5:00 pm

Sorry, I'm a beginner here so I apologize for these revised posts I keep sending...

I figured out the source code. I just went to Google Chrome and saw the code. I couldn't figure out how to do that in Safari (if anyone knows how, let me know!) I saw how the line was just a continuous line but still don't understand how that happened.

I created the text file using Livecode. I followed Elanor's instructions and the file created great! It also displayed accurately (as I have mentioned before), when I housed the text file in my computer's Documents folder. So, here is the question, how do I get this not to happen? How do I make sure Livecode creates the form accurately using the return line breaks? (I do use the "return" command in the card's code)

LCNeil
Livecode Staff Member
Livecode Staff Member
Posts: 1223
Joined: Wed Oct 03, 2012 4:07 pm

Re: Files & Folders on a secure server

Post by LCNeil » Thu Oct 17, 2013 5:16 pm

Hi Tom,

I've had a look at the writingToFile stack that Elanor created and although this is writing the text file correctly and it this displays correctly when running on the desktop environment, it seems that there is a possible bug that is causing carriage returns to be stripped when read from an online directory. The bug seems to affect text files created on Mac OSX as text files created on Windows do not have this problem.

The following is an example created on windows with Elanors stack, and you will see that it displays correctly in both the text file and page source-

http://techsupport.on-rev.com/weatherData.txt

I will need to investigate this further. Once I have done this, I will report back to here with my findings.

Kind Regards,

Neil Roger
--
RunRev Support Team ~ http://www.runrev.com
-

Post Reply

Return to “idea2app and Coding School”