Hello,
I am making an app that involves generating a PDF. What I want to do is copy that PDF file to a folder on the server side as well. Is that possible? Right not the app is asking the user where to store the file on the client side.
You’ve put this in Targets: Web, is this a web app? A web app is already running on the server, all you’d have to do is write out the PDF data to a FolderItem.
Do you mean something else? If you’re looking to upload to a server from a desktop app, this is a bit different and requires plugins or libraries.
It is a web app but I am confused about it. I made a pdf following the sample on line:
//draw the pdf
wf = New WebFile
wf.Data = d.ToData
wf.MIMEType = "application/pdf"
wf.Filename = "DueDateList.pdf"
wf.ForceDownload = True
Call wf.Download
then I create and/or check for th folder where I want the PDF to be stored
var path as NEW FolderItem("")
path = path.Child("Ship Forms")
if path.Exists = False then
path.CreateFolder
end if
Where I’m getting stuck is to make a copy of wf to that folder
A FolderItem
in a web app represents a file *on the server*. If you want to save that PDF to your server you could do so like this:
// Get a writable location that won't be destroyed
var fAppData as FolderItem = SpecialFolder.ApplicationData.Child("my.webapp.identifier")
if not fAppData.Exists then
fAppData.CreateFolder
end
var fShipForms as FolderItem = fAppData.Child("Ship Forms")
if not fShipForms.Exists then
fShipForms.CreateFolder
end
var fTarget as FolderItem = fShipForms.Child("DueDateList.pdf")
// d is the PDFDocument you built
d.Save(fTarget)
I *would not* recommend trying to use a location next to the application itself (as your code implied). No matter what platform you are developing for (desktop, web, mobile, anything), that’s a terribly unreliable location.
It’s not entirely clear if you’re expecting to be able to write a file directly to the user’s computer. That’s not possible for the safety of everyone on the internet.
Thanks @Tim_Parnell. That was exactly what I was looking for. As always, I truly appreciate your help