PDF File Upload
Moderators: FourthWorld, heatherlaine, Klaus, kevinmiller, robinmiller
PDF File Upload
Hi wonder if someone can help me.
I have created an application in studio 3.5 and wanted to upload a PDF file so that users are able to open the PDF when they click on a button.
Is this easily done on revolution?
Cheers
Daniel
I have created an application in studio 3.5 and wanted to upload a PDF file so that users are able to open the PDF when they click on a button.
Is this easily done on revolution?
Cheers
Daniel
-
- VIP Livecode Opensource Backer
- Posts: 977
- Joined: Sat Apr 08, 2006 7:47 am
- Contact:
Assuming that you're uploading to an FTP server, it can be a one-liner like
It's always safest to read files to upload as binary files.
HTH,
Jan Schenkel.
Code: Select all
put URL("binfile:" & tLocalPath) into URL("ftp://user:password@example.org/" & tRemotePath)
HTH,
Jan Schenkel.
Quartam Reports & PDF Library for LiveCode
www.quartam.com
www.quartam.com
Thanks Jan
Is there not a way of uploading my PDF file to my stack in RunRev like I would do my website and then for a user to click a button for the PDF to open?
Just not too sure about this FTP server. I have a linux based hosted website. Going by your code if my
username is bsouthuk
password is manutd07
domain is porrima-qg.com
file name that i have uploaded to my site is QG.PDF
Then should the exact code be:
Is this right?
And when you click on the button, the PDF file will show in a browser?
Cheers
Dan
Is there not a way of uploading my PDF file to my stack in RunRev like I would do my website and then for a user to click a button for the PDF to open?
Just not too sure about this FTP server. I have a linux based hosted website. Going by your code if my
username is bsouthuk
password is manutd07
domain is porrima-qg.com
file name that i have uploaded to my site is QG.PDF
Then should the exact code be:
Code: Select all
put URL("binfile:" & tLocalPath) into URL("ftp://bsouthuk:manutd07@porrima-qg.co.uk/qg.pdf" & tRemotePath)
And when you click on the button, the PDF file will show in a browser?
Cheers
Dan
I really hope these are not real login credentials... If they are, I advise to edit your post and REMOVE THEM IMMEDIATELY!!!
Maybe you meant not "upload" (which is always to a server) but "store" (for example within a stack)
you can do that:
Maybe you meant not "upload" (which is always to a server) but "store" (for example within a stack)
you can do that:
Code: Select all
set the storedPDF of this stack to url ("binfile:" & "somefile.pdf")
put the storedPDF of this stack into url ("binfile:" & "someotherfile.pdf")
launch "someotherfile.pdf"
Various teststacks and stuff:
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
http://bjoernke.com
Chat with other RunRev developers:
chat.freenode.net:6666 #livecode
Hi bsouthuk,
BvG already answered your question:
Best,
Mark
BvG already answered your question:
Code: Select all
set the storedPDF of this stack to url ("binfile:" & "somefile.pdf")
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
I think i'm having a blonde moment hear.
The name of my pdf file is "o2.pdf"
Therefore am I right in saying that I type the following code in a button and it will store the PDF that I have saved on my desktop and open the PDF file when I click the button?
The code I have is:
Is this right?
The name of my pdf file is "o2.pdf"
Therefore am I right in saying that I type the following code in a button and it will store the PDF that I have saved on my desktop and open the PDF file when I click the button?
The code I have is:
Code: Select all
set the storedPDF of this stack to url ("binfile:" & "o2.pdf")
put the storedPDF of this stack into url ("binfile:" & "o2.pdf")
launch "o2.pdf"
bsouthuk,
Set the storedPDF property from the message box, using the first line. Make sure that the path to the PDF is correct. Probably it should be something like "C:/folder/folder/o2.pdf" instead of simply "o2.pdf".
In your button, you can use the remaining two lines. Again, make sure that you use a correct path, e.g. to the temp directory or to the desktop. The launch command needs a correct file path too.
If you try your code and get errors, post the errors in this forum.
Best,
Mark
Set the storedPDF property from the message box, using the first line. Make sure that the path to the PDF is correct. Probably it should be something like "C:/folder/folder/o2.pdf" instead of simply "o2.pdf".
In your button, you can use the remaining two lines. Again, make sure that you use a correct path, e.g. to the temp directory or to the desktop. The launch command needs a correct file path too.
If you try your code and get errors, post the errors in this forum.
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Thanks Mark though having some problems - when i click on the button, nothing actually happens.
In the button I have the following code:
In the stack property inspector under 'custom properties' it says 'StoredPDF" then underneath this in the'properties context' box it has the following some crazy lines of code which looks chinese or something. Thousands of lines!
Then in the 'External references' the following:
C:/Users/Daniel Shapiro/Desktop/Daniel/Commercials/O2/Business tariff and bundle Pricing.pdf
What am I doing wrong?
Cheers
Dan
[/code]
In the button I have the following code:
Code: Select all
on mouseUp
put the storedPDF of this stack into url ("binfile:" & "C:/Users/Daniel Shapiro/Desktop/Daniel/Commercials/O2/Business tariff and bundle Pricing.pdf")
launch "C:/Users/Daniel Shapiro/Desktop/Daniel/Commercials/O2/Business tariff and bundle Pricing.pdf"
end mouseUp
Then in the 'External references' the following:
C:/Users/Daniel Shapiro/Desktop/Daniel/Commercials/O2/Business tariff and bundle Pricing.pdf
What am I doing wrong?
Cheers
Dan
[/code]
Hi Dan,
Do you use Mac OS X or Windows?
Normally, you should not hardcode the filepath. You should create the filepath using a system-dependent component and a file-dependent component. For example:
specialfolderpath("temp") & "/someuniquefilename.pdf"
specialfolderpath("desktop") & "/yourpdf.pdf"
item 1 to -2 of the effective filename of this stack & "/yourpdf.pdf"
et cetera...
Best,
Mark
Do you use Mac OS X or Windows?
Normally, you should not hardcode the filepath. You should create the filepath using a system-dependent component and a file-dependent component. For example:
specialfolderpath("temp") & "/someuniquefilename.pdf"
specialfolderpath("desktop") & "/yourpdf.pdf"
item 1 to -2 of the effective filename of this stack & "/yourpdf.pdf"
et cetera...
Best,
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
Hi Daniel,
shouldn't that beinstead of ? Could you try this? You might want to look up 'launch' and 'launch dokument' in the dictionary.
regards
Bernd
shouldn't that be
Code: Select all
launch document "C:/Users/Daniel Shapiro/Desktop/Daniel/Commercials/O2/Business tariff and bundle Pricing.pdf"
Code: Select all
launch "C:/Users/Daniel Shapiro/Desktop/Daniel/Commercials/O2/Business tariff and bundle Pricing.pdf"
regards
Bernd
bsouthuk,
The launch document command should work. I have had, hwoever, quite a few problems with it on Windows XP and Vista.
Try something like this:
Best,
Mark
The launch document command should work. I have had, hwoever, quite a few problems with it on Windows XP and Vista.
Try something like this:
Code: Select all
put specialfolderpath(desktop) & "/Commercials/O2/Business tariff and bundle Pricing.pdf" into myFilePath
if there is a file myFilePath then
set the hideConsoleWindows to true
put "start" && quote & quote && quote & myFilePath & quote into myShell
get shell(myShell)
else
beep
answer "Can't find file" && myFilePath
end if
Mark
The biggest LiveCode group on Facebook: https://www.facebook.com/groups/livecode.developers
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode
The book "Programming LiveCode for the Real Beginner"! Get it here! http://tinyurl.com/book-livecode