New topic: 

GetSaveFolderItem Problem?

<http://forums.realsoftware.com/viewtopic.php?t=47774>

         Page 1 of 1
   [ 6 posts ]                 Previous topic | Next topic          Author  
Message        p0wn3d          Post subject: GetSaveFolderItem Problem?Posted: 
Fri May 03, 2013 6:36 am                                 
Joined: Sun Oct 28, 2012 4:54 am
Posts: 253
Location: Herts, UK                From the examples in the LR I am doing this 
on a button click. But getting error "GetSaveFolderItem - this item does not 
exist)

Dim f As FolderItem
Dim fileStream as TextOutputStream
f=GetSaveFolderItem(FileTypes1.Text,"My Info")
If f <> Nil then
  fileStream=TextOutputStream.Create(f)
  fileStream.WriteLine namefield.text
  fileStream.WriteLine addressfield.text
  fileStream.WriteLine phonefield.text
  fileStream.Close
End if


I have added a Filetype set to the project. Either I have missed something or I 
am going mad 

Thanks      
_________________
Real Studio 2012 R2
SysInfo
BackTrack Linux/BackBox Linux/Debian Lenny/Windows 7/Windows 8/OpenWRT/OpenBSD
& Yes it's me in the Avatar  
                             Top                Jason_Adams          Post 
subject: Re: GetSaveFolderItem Problem?Posted: Fri May 03, 2013 8:07 am         
                        
Joined: Fri Nov 10, 2006 4:10 pm
Posts: 1815
Location: Michigan, USA                You can't retrieve a folderitem from the 
user's browser. This simply can't be done.

In order to "save" something to a browser, you create the file on the server, 
then use a WebFile and set WebFile.ForceDownload to true. Be sure to use the 
WebSession.Identifier somewhere (usually a directory to create the file in), so 
that you don't accidentally overlap multiple sessions doing the same thing.

Hope this helps.     
_________________
Windows 7 Ultimate x64
Windows XP Pro SP3
Ubuntu 11.04 via Virtual Box
RS Enterprise 2012r1.1

Programming Tutorials & Free Projects: http://www.JasonTheAdams.com
"Christianity has not been tried and found wanting; it has been found difficult 
and not tried." - G.K. Chesterton  
                             Top                p0wn3d          Post subject: 
Re: GetSaveFolderItem Problem?Posted: Fri May 03, 2013 8:41 am                  
               
Joined: Sun Oct 28, 2012 4:54 am
Posts: 253
Location: Herts, UK               Thanks Jason

Basically what I trying to do is. I have a Textarea on a webpage along with a 
button. When the user clicks the button I somehow grab the text content from 
the Texarea control and prompt the user to save it as a text file on their 
local PC.      
_________________
Real Studio 2012 R2
SysInfo
BackTrack Linux/BackBox Linux/Debian Lenny/Windows 7/Windows 8/OpenWRT/OpenBSD
& Yes it's me in the Avatar  
                             Top                Jason_Adams          Post 
subject: Re: GetSaveFolderItem Problem?Posted: Fri May 03, 2013 9:02 am         
                        
Joined: Fri Nov 10, 2006 4:10 pm
Posts: 1815
Location: Michigan, USA                There's an example just like this in the 
LR: http://docs.realsoftware.com/index.php/WebFile.Data

Just change "Hello World!" to the contents of your text area.     
_________________
Windows 7 Ultimate x64
Windows XP Pro SP3
Ubuntu 11.04 via Virtual Box
RS Enterprise 2012r1.1

Programming Tutorials & Free Projects: http://www.JasonTheAdams.com
"Christianity has not been tried and found wanting; it has been found difficult 
and not tried." - G.K. Chesterton  
                             Top                p0wn3d          Post subject: 
Re: GetSaveFolderItem Problem?Posted: Fri May 03, 2013 9:15 am                  
               
Joined: Sun Oct 28, 2012 4:54 am
Posts: 253
Location: Herts, UK               Thanks Jason got it now from the example...

TextFile = New WebFile // TextFile is a property of the web page
TextFile.MimeType = "text/plain"
TextFile.ForceDownload = True // If False, the browser may try to display the 
file instead of download it
TextFile.FileName = "TextFile.txt"
TextFile.Data = "Hello, world!"
ShowURL(TextFile.URL) // This causes the file to be downloaded


I wish the LR would be a little more friendly at times. IE: In this case "You 
need to create a new Property
textfile As Webfile'      
_________________
Real Studio 2012 R2
SysInfo
BackTrack Linux/BackBox Linux/Debian Lenny/Windows 7/Windows 8/OpenWRT/OpenBSD
& Yes it's me in the Avatar  
                             Top                Jason_Adams          Post 
subject: Re: GetSaveFolderItem Problem?Posted: Fri May 03, 2013 9:31 am         
                        
Joined: Fri Nov 10, 2006 4:10 pm
Posts: 1815
Location: Michigan, USA                I encourage you to sift through the 
examples, too, as that is pretty well organized. I've learned quite a bit over 
the years from glancing through those. And there is a 
/Web/Downloading/Downloading.rbp example that goes over this.     
_________________
Windows 7 Ultimate x64
Windows XP Pro SP3
Ubuntu 11.04 via Virtual Box
RS Enterprise 2012r1.1

Programming Tutorials & Free Projects: http://www.JasonTheAdams.com
"Christianity has not been tried and found wanting; it has been found difficult 
and not tried." - G.K. Chesterton  
                             Top             Display posts from previous: All 
posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost 
timeSubject AscendingDescending          Page 1 of 1
   [ 6 posts ]      
-- 
Over 1500 classes with 29000 functions in one REALbasic plug-in collection. 
The Monkeybread Software Realbasic Plugin v9.3. 
http://www.monkeybreadsoftware.de/realbasic/plugins.shtml

[email protected]

Reply via email to