SUMMER SALE - USE DMXSUMMER19 PROMO CODE FOR UP TO 51% OFF

Upload Multiple Files and Store their Names into a Database

Upload Multiple Files and Store their Names into a Database

Learn how to upload multiple files and store their names into a database

With this movie we will show you how to upload multiple files and store their names into a database.

Step by Step

We created a form containing a text input and a multiple file field (1). The name of your multiple file field must end with two square brackets (2). Create a new server action (3-4). 

Select globals (1), browse to your multi upload page (1-4).

Import the form fields (1-3). 

Right click steps(1) and add a database connection (2-3).

Select load from local (1-2)

Add file upload (1-3).

Select the upload field (1). Under globals, post, select your multi upload field (2-3).

Select your upload path (1-3). Setup the rest of the file upload options (4).

Right click file upload step(1) and add a repeat (2-3).

Select an expression for the repeat (1). Select the file upload step as an expression (2-3).

Right click steps inside the repeat(1) and add database insert (2-3). Steps inside the repeat will be executed as many times as the number of uploaded files is.

Setup the insert options (1). Select and add the database table where you'd like to insert uploaded files names (2-3 and 1 of next image).

Add the columns you'd like to populate with data (2-3). Select the column where you want to store uploaded files names (4). Select its value (5).

Under the repeat step, select the name binding returned by the file upload (1-2).

We also want to store the text, populated in the text input with each of the uploaded files (1). Select its value (2).

Select your text field under globals, post (1-2). Click ok when you're done (3).

Save your server action (1). Open app connect panel (2).

Add app connect to your page.

Select your form in the app connect tree(1) and change its handler to server connect (2-3).

Select your multi upload server action in the action field (1-3). 

We'd like to reset form fields when the files are successfully uploaded. Add a new dynamic event (1). Open server connect (2). And select on success (3).

Select the dynamic event (1). Under server connect form, select reset (2-3).

And we are done! 

That's how easy it is to upload multiple files and store their names into a database.

Extensions Covered

Comments

Be the first to write a comment

You must me logged in to write a comment.