How do I upload photos or to ftp / web server from an oracle apex application?
I have an Oracle Apex 5.0 application that is used for data entry, and an ASP.NET MVC5 application that is used for displaying the data.
Currently, my process is to upload the files manually to the web server through FTP, then store the URLs of the photos and files in a text field in the database. This process is cumbersome, and requires a lot of copying / pasting.
Ideally, I would like to be able to drag and drop photos onto a region on the web page which uploads the photos to the web server, and stores the URL in the text field. This process would also create a resized / thumbnail version of the photo that lives alongside the full size image.
I do not want to store the photos as blobs or attachments inside the database, as they are difficult to work with programatically in other web applications.
APEX would not have a good way to do what you’re asking programmatically. As APEX runs from inside the database and has no default access to the OS, you would have to:
- Somehow grant the Oracle DB access to the web server file directories
- Store the files as BLOBs
- Figure out how to decode and write the files to the an OS directory using a PL/SQL stored procedure
- Delete the BLOBs
Ideally, your web server should not be running on the same host as your database server as this would pose a significant security risk, so right off the bat you are going to have multiple issues.
A better approach would be a shell script that runs some combination of scp or sftp along with sqlplus to first copy the files securely to the web server and then update the database table with the correct URLs. In most environments this sort of automation would be relatively straight forward to implement. It won’t have a pretty GUI through a web page, but you’ll get better, practical results a lot faster and with a lot less effort.