13 Replies Latest reply: Jan 15, 2014 5:36 AM by Nicolette RSS

Uploading file in Apex 4.2.2

Vladimir Rodic Newbie
Currently Being Moderated

Hello,

 

I am beginner with Apex and trying to make first application.

 

I need to upload a file to the server, file directory (not only to the DB as BLOB).

 

I was following this tutorial How to Upload and Download Files in an Application

without success. I always end up with a blank page. I am doing something wrong, but do not know what.

I did not manage to find any tutorial on this topic online.

 

Here is an example of the application:

 

http://apex.oracle.com/pls/apex/f?p=4550:1:::::F4550_P1_COMPANY:SCHENKERTEST

Workspace: SCHENKERTEST

Username: tester

Password: test

  • 1. Re: Uploading file in Apex 4.2.2
    AndyPol Expert
    Currently Being Moderated

    Hi

    Please change your name: 023368a0-3225-4a38-856d-7104bc7243c6

     

    In APEX you can't natively upload file to file system. File Browser Item upload it to database. You can try flush file to oracle directory but you have to create own process.

     

    Regards

  • 2. Re: Uploading file in Apex 4.2.2
    Vladimir Rodic Newbie
    Currently Being Moderated

    Name changed.

     

    I am aware that one can't natively upload file to file system. Right now if you see the example application, I am not even able to upload it to the database.

     

    Anyone has an idea where the problem is?

     

    Once again, I am a beginner with Apex. This is the first application I have to make.

     

    Regards

  • 3. Re: Uploading file in Apex 4.2.2
    Zack.L Explorer
    Currently Being Moderated

    Hi

    Sample File Upload and Download

     

    If you have not already install the above, then install and unlock and you can see how it's done.

     

    HTH

    Zack

     

  • 4. Re: Uploading file in Apex 4.2.2
    Nicolette Expert
    Currently Being Moderated

    Vladimir Rodic

     

    How have you determined that the files aren't uploaded?

    As far as I can see the application has only an upload facility.

    No where are the uploaded files shown.

    You do need to implement the second part of the tutorial where you create a report that shows the uploaded documents.

     

    The nature of the file browse item is that it is always empty up on load of the page. This is for security reasons.

     

    Since page 1 doesn't have any branches you return to the same page when you click the submit button.

     

    If you're on apex 4 you might want to check out this plugin Save to disk which takes care of the saving to disk for you.

     

    Nicolette

  • 5. Re: Uploading file in Apex 4.2.2
    Giedrius S. Newbie
    Currently Being Moderated

    Could you check if your page with upload item has a brach? I had this problem (blank page) when uploading files in a page without branches. Just added branch to the same page and problem was gone.

     

    Giedrius

  • 6. Re: Uploading file in Apex 4.2.2
    Vladimir Rodic Newbie
    Currently Being Moderated

    How do I make page branches? Any tutorial on this. I did make a landing page, to redirect user there after file upload, but I do not know where to do that redirection or branching.

  • 7. Re: Uploading file in Apex 4.2.2
    Nicolette Expert
    Currently Being Moderated

    Vladimir Rodic

     

    Start with the Application Express Application Builder User's Guide and the 2 Day + Application Express Developer's Guide.

    Both are found trough the documentation page of Application Express product page.

    Make sure you are using the documentation the belongs to the apex version you are using. (look at the documentation archives for older versions).

     

    Nicolette

  • 8. Re: Uploading file in Apex 4.2.2
    Vladimir Rodic Newbie
    Currently Being Moderated

    OK in this version it's called redirect to page in this application instead of branching.


    I will take a look at the save to disk plugin.

  • 9. Re: Uploading file in Apex 4.2.2
    Vladimir Rodic Newbie
    Currently Being Moderated

    Current version of 2 day + Application Express Developer's Guide does not have a part about uploading file. I have already checked that one. Will take a look at Builder User's Guide!

  • 10. Re: Uploading file in Apex 4.2.2
    Nicolette Expert
    Currently Being Moderated

    Vladimir Rodic

     

    The mention of the documentation was in reaction of your question about how to make branches not on the file upload.

     

    Nicolette

  • 11. Re: Uploading file in Apex 4.2.2
    Nicolette Expert
    Currently Being Moderated

    Vladimir Rodic

     

    Vladimir Rodic wrote:

     

    OK in this version it's called redirect to page in this application instead of branching.

    No it is not.

    If a button does a redirect the page is not submitted and any page processes that are run on page submit are not run.

    Any saving of values to the datebase is normally done on page submit.

     

    Read the chapter Application Builder Concepts of the Application Builder User's Guide for an explanation of what happens with the page processing and rendering.

     

    Nicolette

  • 12. Re: Uploading file in Apex 4.2.2
    Vladimir Rodic Newbie
    Currently Being Moderated

    Hello,

    I have managed to upload files as BLOB into the database. Thank you for the help with the branching issue. That was the missing knowledge I needed.

     

    The last part that I am missing is to be able to save the file on the server (file system) instead of the database. I have seen the plugin Save to Disk Nicolette has suggested, but I prefer to have more control over what is done as there will be later changes required.

     

    My question is:

    1. where and how to run the PL/SQL code Writing Oracle BLOB to OS file (I found example here) after the file is uploaded?

    I believe I need to create a Process - Point: On Submit - After Computations and Validations

     

    Do I create a process as part of Page Rendering or Page Processing? I see that both have offered Processes.

    Is there some better example of PL/SQL code for writting file from BLOB to file system?

     

     

    Additional and last question would be:

    2. how to start after that a batch script on the server through Apex? Batch script that has to do something with the file (and of course I need to forward file name and location to that batch script).

  • 13. Re: Uploading file in Apex 4.2.2
    Nicolette Expert
    Currently Being Moderated

    Vladimir Rodic

     

    Vladimir Rodic wrote:

     

    1. where and how to run the PL/SQL code Writing Oracle BLOB to OS file (I found example here) after the file is uploaded?

    I believe I need to create a Process - Point: On Submit - After Computations and Validations

     

    Do I create a process as part of Page Rendering or Page Processing? I see that both have offered Processes.

    Is there some better example of PL/SQL code for writting file from BLOB to file system?

     

     

    This is the process point I would use. But any process point "On Submit" should do.

    You create the process as part of the page processing. This is the phase when data is on submit passed from the browser/client to the server. And the data is processed.

    As for the code take a look at the code that is used by the plugin I mentioned in an earlier post.

    Additional and last question would be:

    2. how to start after that a batch script on the server through Apex? Batch script that has to do something with the file (and of course I need to forward file name and location to that batch script).

    Take  a look at Using Events (11) and Using the Scheduler(10) (notice the difference in database versions of the documentation).

    The workflow would be something like: on processing the uploaded document raise an event. Which starts a job. And that job can run a batch script.

    I have only read about the possibilities but have no experience using the combination of events and jobs.

     

    Nicolette

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points