Real Software Forums

The forum for Real Studio and other Real Software products.
[ REAL Software Website | Board Index ]
It is currently Thu Oct 19, 2017 8:01 am
xojo

All times are UTC - 5 hours




Post new topic Reply to topic  [ 8 posts ] 
Author Message
 Post subject: create file and download - Web Edition
PostPosted: Wed Apr 24, 2013 9:26 am 
Offline

Joined: Wed Nov 17, 2010 10:49 am
Posts: 38
Hi,

To create a text file in a variable (webfile).

To ask the download location (with SaveAs dialog - yes in web edition)

Save the file on client.

All these in Web Edition.

Thanks,


Top
 Profile  
Reply with quote  
 Post subject: Re: create file and download - Web Edition
PostPosted: Wed Apr 24, 2013 9:43 am 
Offline
User avatar

Joined: Tue Jan 04, 2011 3:02 am
Posts: 1236
Location: Jönköping, Sweden
shahiddarbar wrote:
Hi,
To create a text file in a variable (webfile).
To ask the download location (with SaveAs dialog - yes in web edition)
Save the file on client.
All these in Web Edition.
Thanks,


Simply put your textfile in a WebFile and present it to the client.
Pseudo code.
yourWebFile = WebFile.Open(f) '<--Folderitem to your textfile.
yourWebFile.MIMEtype = "text/plain"
yourWebFile.ForceDownload = True
ShowURL YourWebFile.URL


Remember to put "yourWebFile" in the Session or it might die too soon.

Where the file will be saved on the clients computer depends on their browser settings :)

_________________
Image http://www.linkedin.com/in/albinkiland
Dev. iMac 27" + 2x22" LG (2.8GHz Intel Core i7, 12GB RAM, 120GB SSD) OS X 10.8
Xojo Pro 2013r1


Top
 Profile  
Reply with quote  
 Post subject: Re: create file and download - Web Edition
PostPosted: Wed Apr 24, 2013 9:50 am 
Offline

Joined: Wed Nov 17, 2010 10:49 am
Posts: 38
can we get a saveas dialog so they can select where to save?

also, there is no physical file on server, the new file has to be created on fly

is this possible?


Top
 Profile  
Reply with quote  
 Post subject: Re: create file and download - Web Edition
PostPosted: Wed Apr 24, 2013 10:29 am 
Offline

Joined: Wed Nov 17, 2010 10:49 am
Posts: 38
ok,

I am getting saveas box (not saveas dialog) on atleast opera and IE, safari and chrome save to default download location.



Is there a way to create a text webfile in code?


thanks,


Top
 Profile  
Reply with quote  
 Post subject: Re: create file and download - Web Edition
PostPosted: Wed Apr 24, 2013 12:54 pm 
Offline
User avatar

Joined: Tue Jan 04, 2011 3:02 am
Posts: 1236
Location: Jönköping, Sweden
If you don't have a file on the server, see WebFile.Data
You can't decide where the client will save the file. It's all in the control of "the client".
Personally I've set my browser to automatically download all downloadable files into a predefined directory so I never see the SaveAs Dialog. This setting can't be forced :)

_________________
Image http://www.linkedin.com/in/albinkiland
Dev. iMac 27" + 2x22" LG (2.8GHz Intel Core i7, 12GB RAM, 120GB SSD) OS X 10.8
Xojo Pro 2013r1


Top
 Profile  
Reply with quote  
 Post subject: Re: create file and download - Web Edition
PostPosted: Mon May 06, 2013 8:51 pm 
Offline

Joined: Thu Apr 18, 2013 8:59 am
Posts: 12
Location: Mexico
Im trying to open a pdf file following the instructions you kindly gave us, but i get nil object exception when the execution gets to the line
Session.pdffile.ForceDownload=True

here is my code
dim f as folderItem
f = GetFolderItem("../"+Session.usuario+"-report.pdf")
Session.pdfFile = New WebFile
Session.pdffile = WebFile.Open(f)

Session.pdffile.ForceDownload=True
Session.pdffile.MIMEType= "application/pdf"
ShowURL(Session.pdffile.URL)

Help please.
TIA


Top
 Profile  
Reply with quote  
 Post subject: Re: create file and download - Web Edition
PostPosted: Tue May 07, 2013 12:56 am 
Offline
User avatar

Joined: Tue Jan 04, 2011 3:02 am
Posts: 1236
Location: Jönköping, Sweden
vcetina wrote:
Im trying to open a pdf file following the instructions you kindly gave us, but i get nil object exception when the execution gets to the line
Session.pdffile.ForceDownload=True

here is my code
dim f as folderItem
f = GetFolderItem("../"+Session.usuario+"-report.pdf")
Session.pdfFile = New WebFile
Session.pdffile = WebFile.Open(f)

Session.pdffile.ForceDownload=True
Session.pdffile.MIMEType= "application/pdf"
ShowURL(Session.pdffile.URL)

Help please.
TIA


Are you sure it's on that line and not the one above? (Session.pdffile = WebFile.Open(f))
Your FolderItem don't look right to me, it might not find the file and therefor give you an error on WebFile.Open(f).

_________________
Image http://www.linkedin.com/in/albinkiland
Dev. iMac 27" + 2x22" LG (2.8GHz Intel Core i7, 12GB RAM, 120GB SSD) OS X 10.8
Xojo Pro 2013r1


Top
 Profile  
Reply with quote  
 Post subject: Re: create file and download - Web Edition
PostPosted: Wed May 08, 2013 11:26 am 
Offline

Joined: Thu Apr 18, 2013 8:59 am
Posts: 12
Location: Mexico
Thanks for the advice Akiland. Problem solved, the file path was wrong.

Now im trying to create a HTML file with a predefined string, with the path to the pdf (to display the html in a separate window using javascrip window.open). But when asigning the string with the returned hml in this way
session.fHTML.data=createHTML(session.pdf.url)

im getting NIL OBJECT EXEPTION. The error is generated in this line, not in the createHTML function.


Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 8 posts ] 

All times are UTC - 5 hours


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum

Search for:
Jump to:  
Powered by phpBB © 2000, 2002, 2005, 2007 phpBB Group