Hi
I am trying to add multiple file upload feature to a form. I am wondering if there is a way to upload the files before submitting the form and them when the form is submitted and the data inserted into the database, the files get uploaded to the designated folder.

I am trying to do this way in order to minimize the load on the server.

In short I want to store files to a temporary location, and when the form is submitted they get moved to the designated folder.

I am concern about the logic of it more than the code itself.

thanks

KHR,

I'm sure you could write code to do what you describe if you really needed to, however I think it would not meet your objective to reduce load on the server. As far as I can tell, the load would increase as there is extra work for the server in transferring files from their temporary location to their final destination.

But the main problem is in the user interface.

There would need to be at least two user-events - one (or more) for file upload(s) and one for form submission. This is potentially confusing for users, whose general expectation will be for a single "commit" for all data.

I guess there must be circumstances where two-stage submission would be appropriate but UI aspects would need to be very carefully considered.

Airshow

Member Avatar for diafol

Good advice AS.
However, there's a nice set of demos here - one for JQuery and one for Prototype:

http://valums.com/ajax-upload/

I really like the UI.

Well found Ardav. That's the sort of UI required.

I would be even happier if it supported a reliable overview of uploads to date, and selective "withdrawal" of uploads prior to final form submission.

Airshow

Member Avatar for diafol

Well found Ardav. That's the sort of UI required.

I would be even happier if it supported a reliable overview of uploads to date, and selective "withdrawal" of uploads prior to final form submission.

Airshow

Fair one.

Thank you for the advice guys, have you seen vbullten form for adding topics.

The files that I upload using the form have to be linked to the id of the topic submitted. Since the topic is not submitted, its id in the database is not created. I do not want to add multiple upload inputs in the form as it might cause some problems in submitting the form particularly if the server stops my script in the middle of its process due to a high usage of the server.

Anyway thanks for the advice

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.