thanks for the support but i dont have this lvl for do it
Based on your screenshot, the file is in OneDrive...why not obtain the URL for the file and put that in the source for the PDFViewer. Also, that script is to get a listing of files sorted by modified date which you would have to add to it to do something else that you need like getting the file names and modified dates and store them in a dataset to compare from what you previously had...then trigger some other action if there is a change in the dates...but you hard-coded 1 file. So, my question is...how often will this file be changing? Every minute, hourly, daily? You'll get the latest file when someone navigates to the view. Are you worried someone will stay on the view for days without refreshing?
yeah the file is on a folder from PC , i dont have a URL
You need a URL to display in Perspective. Full stop.
WebDev makes it possible to expose files in the gateway at desired URLs.
Making anything that reliably exposes files from a OneDrive is going to be a challenge. Don't do that.
i was using both options , first i created for each file on Web Dev and the second on the folder of webserver because if the file has changes it will change on the View
these options works good , but the folder on the webserver can be modified while the application is active.
Don't mount every file individually in WebDev. Write a script for a doGet()
endpoint that receives a file name as a URL query parameter. Read that file (only from the storage folder) and deliver it. Scripted reads and delivery of file content won't hold the file open.
im really sorry with you , but you have a example?? im new with this module i never had used it
The manual describes it pretty well.
Start here:
The rough structure of your doGet()
method is going to be as follows:
def doGet(request, session):
#get filename from request['params'] (not sure if it needs to be manually URL-decoded, might need to add this step)
#should also normalize the filename input to prevent funny business (directory traversal)
#left as exercise for the reader
#read file into a variable using system.file.readFileAsBytes()
contents = system.file.readFileAsBytes(file_path)
#return the file contents
response = { 'bytes': contents, 'contentType': 'application/pdf' }
return response