Announcement Announcement Module
No announcement yet.
Deferred file upload Page Title Module
Move Remove Collapse
Conversation Detail Module
  • Filter
  • Time
  • Show
Clear All
new posts

  • Deferred file upload

    I am writing a web application that allows the user to enter large multimedia files, together with descriptions of what they contain. Therefore, each page contains string, number, date,... fields, together with a file selection dialog for the file to be uploaded.

    If I implement this in the straightforward way, the user will have to wait quite a few minutes after completion of each form. Only afterwards, the next form will be displayed, and he can continue entering data and the next multimedia file. That way, he has to sit in front of his browser the whole day, entering data for a few minutes, waiting the rest of the time.

    Therefore, I'd like to let him enter the file names, assisted by a file selection box, but not start the file upload immediately, instead remember the file name in my system and perform all the remembered uploads when it's convenient for the user. This would mean modularizing the file upload functionality, separating the file selection step from the actual upload step.

    I'd strongly prefer not to assume anything running on the client but a HTML browser. People block, consciously or not, things like Applets, JavaScript, and other Scripts, so I wouldn't rely any of those will be available.

    I know this is not a genuine Spring question, as the behavior of the input file element is determined by HTML. However, maybe I'm lucky here and someone has solved a similar problem before.

  • #2
    Unfortunately the HTML spec prevents programmatic setting of the file upload box. It does this for security reasons.

    You might be able to something clever with javascript?


    • #3
      That security argument is valid, of course. If I stored the file paths and got the files later, I might change the paths, therefore getting whichever file from the user's disk that I might be curious to see.

      So maybe I'll offer both mechanisms, so that users who trust the application can have some comfort, and the others stick to the traditional html way.


      • #4
        I'm confused, easily done

        What are the "both" ways? I do not see how you can get a list of files and then programmatically upload them later.

        The *only* (always a dangerous word ) way to upload the file using the file control is to get them to pick it and upload it on one form.

        Do you know of another way using javascript?


        • #5
          I don't know anything yet about a deferred solution, so when I said "both" ways, I was optimistic about finding a way after following your suggestion to try with JavaScript.