on-rev writing to

Sarah Reichelt sarah.reichelt at gmail.com
Mon May 2 04:09:59 EDT 2011


Write the irev file first with placeholder variables instead of data
that would be sent.
e.g.

<?irev
   put "tom" into tFolderName
   put "prefs.txt" into tFileName
   put "someSetting=true" into tData

   -- now create the folder if required
   -- save the data to the appropriate file

   put "OK"    -- show that it's worked
?>

Now test it from your browser by going to
http://yourdomain.on-rev.com/writeData.irev
It should display the OK and you should see the folder & file created.

Once that is working, you can start sending the data to the irev file,
perhaps setting this up one section at a time.
So you could change to calling
http://yourdomain.on-rev.com/writeData.irev?foldername=tom
And change the line in the irev file to: put $_GET["foldername"] into
tFolderName
Then test that this still writes to the correct file.

Just build up the structure gradually until it does everything you need.

Cheers,
Sarah


On Mon, May 2, 2011 at 6:17 AM, Thomas McGrath III <mcgrath3 at mac.com> wrote:
> Thanks, Sarah,
>
> To complicate this I will be writing these files from within an LC app from different clients computers so that each clients app will create (if not present) a folder for them and then write a prefs text file, a text file and some images.
>
> I guess I can look into an iRev file. I just didn't get very far in understanding the 'best' ways to go about that.
>
> Thank you for looking into this for me.
>
> -- Tom McGrath III
> http://lazyriver.on-rev.com
> 3mcgrath at comcast.net
>
> On May 1, 2011, at 5:11 AM, Sarah Reichelt wrote:
>
>> Tom, you cannot write directly to a server.
>> You can upload a file using your FTP login details.
>> But the best solution for your case is to have an irev file on the server that you can call using http://.... And send some data to via POST or GET. Then have the irev file do the actual writing.
>>
>> Not at my Mac right now, so can't give actual examples, but here is the process in untested code:
>>
>> In your script on the desktop:
>>
>> put "http://tom.on-rev.com/writeData.irev" into tURL
>> put "data=" & urlEncode(tDataToWrite) into tPostData
>> post tPostData to URL tURL
>>
>>
>> In the writeData.irev file on the server:
>>
>> put $_POST["data"] into tNewData
>> put tNewData into URL ("file:dataFile.txt")
>>
>> Images will work the same way, but you need to read in the data using binfile:, not file:
>> Then base64encode the binary data before POSTing it.
>>
>> Cheers,
>> Sarah
>>
>>
>> Sent from my iPad
>>
>> On 01/05/2011, at 1:58 AM, Thomas McGrath III <mcgrath3 at mac.com> wrote:
>>
>>> I need to know how to write to on-rev from within an iOS app.
>>>
>>> Is there a best practices around?
>>>
>>> I need to write a folder to my account and then write a text file and some images.
>>>
>>> Are there any sample stacks that show this?
>>>
>>> Is it as simple as put img 1 into url "http://etc."
>>>
>>> or is this something for libURL? ( I haven't used libURL before)
>>>
>>> Any guidance appreciated.
>>>
>>> -- Tom McGrath III
>>> http://lazyriver.on-rev.com
>>> 3mcgrath at comcast.net
>>>
>>>
>>> _______________________________________________
>>> use-livecode mailing list
>>> use-livecode at lists.runrev.com
>>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>>> http://lists.runrev.com/mailman/listinfo/use-livecode
>>
>> _______________________________________________
>> use-livecode mailing list
>> use-livecode at lists.runrev.com
>> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
>> http://lists.runrev.com/mailman/listinfo/use-livecode
>
>
> _______________________________________________
> use-livecode mailing list
> use-livecode at lists.runrev.com
> Please visit this url to subscribe, unsubscribe and manage your subscription preferences:
> http://lists.runrev.com/mailman/listinfo/use-livecode
>




More information about the use-livecode mailing list