Home › Forum › Omnis General Forum › File upload/download
-
File upload/download
Posted by Obonye on October 7, 2024 at 7:48 pmI'm studying the FILE.LBS sample library. There is this line of code that pops-up a window to select a file from the Windows file browser:
Do $cinst.$objs.JSFormFile.$action.$assign(kJSFileActionUpload)
Is there a way to modify this line of code so that the fileactionupload is done in the background and there is no need for a user to select a file? Instead, I would pass a file name and the directory path where the file is saved, upload it and save in the database?
Obonye replied 10 months, 1 week ago 4 Members · 15 Replies -
15 Replies
-
first assign a variable to dataname in the File Control object (visual object), then you have to take the event (evFileUploaded or evDownloadSent), the file is load in the variable
-
I didn’t quite understand this explanation. Would this idea remove the user file attachment prompt to select the 5,000 files?
-
-
Hi Martin,
This would be very scary if a web application would be able to access the local file system of the client without permission.
No – you cannot upload a file in a web application without user permission and this is for a good reason.
Imagine you visit any site on the internet and suddenly your files are uploaded from your machine.
Best,
Andreas
-
Imagine I have 5,000 account statements in PDF saved in my PC that I wish to upload into a list. Uploading these many files one by one would be an arduous task. Is there a way for Omnis to make this easier?
-
Yes – you can allow to upload multiple files if using Omnis Studio 10 or later.
Best,
Andreas
-
Would that mean I create a loop, and the user selects the file to upload 5,000 times for each file?
-
Martin,
In general you can upload several files one after another. Just open the sample library in the HUB that shows the file upload. It says: “select files” (plural) when you click the upload button. You can also drag&drop several files.
ok – 5000 files is a very large number of files to be uploaded. I have never tested those numbers and depending on the file size it might take quite a while. So I wonder if there is any other approach, i.e. using an FTP server for this purpose?
Best,
Andreas
-
This reply was modified 10 months, 1 week ago by
Andreas Pfeiffer.
-
Hi Andreas,
Probably I’m approaching this the wrong way. This is the scenario: I’m thinking of generating customer statements as PDF files and saving them in a windows folder, then emailing them back to the customers. The reason I save them in PDF is to remain with a copy of the statement (with password encryption). So, if I have 5,000 customers, I will need to attach 5,000 pdf files to be emailed to different customers. The easier way would be to automate the file upload than the manual popup window prompt for the user to select each PDF file to attach to an email.
Regards
Martin O.
-
Martin,
I am not sure what you mean with “customer statements”. Couldn’t Omnis create those PDF files? In that case they would already be on the Omnis server.
If not, why not creating FTP access and upload the files that way? The FTP server simply needs to be in the same network as the Omnis server or the Web server you are using.
Best,
Andreas
-
Yes. I’m creating the PDF files in Omnis using the print to Omnis PDF device command. . To do this you must specify the path to save the PDF file. Meaning the file will be saved in a windows folder. But how can I email this PDF to a customer? 5,000 was just an example. It could be millions of customers or 50 customers. It could be a customer statement, bills, employee payslip etc. Still, I shouldn’t design the system to prompt a user to select which file to attach for each of the 50 customers then email.
-
Hi Martin,
So that means that Omnis does have access to the files already. So why uploading then?
Best,
Andreas
-
Really, where are these files saved in Omnis before printing them over to the PDF folder location?
-
They are saved in the PDF folder location as you already mentioned. From there you can use the file object as Uwe already mentioned to pick them up again.
-
Okay. I sure didn’t understand the sample FILE.LBS. I’ll try the file object instead.
-
Hi Obonye,
it was ‘only’ 2.200 files, but I up- and downloaded them to/from Omnis with the FileOps-Object (https://www.omnis.net/developers/resources/onlinedocs/FunctionRef/Functions_A-Z/fileops-readfile.html#fileops.readfile):
Maybe this helps!
Regards
Uwe
-
This reply was modified 10 months, 1 week ago by
-
-
-
-
Log in to reply.