HTML5 File Upload Support Product Page

Answered

Update Form with Multiple File Uploads and Multiple DB Fields

Asked 08 Nov 2015 03:20:10
1
has this question
08 Nov 2015 03:20:10 User  posted:
Hi, I've watched your tutorials on upload/update single file and multiple file upload but they don't quite fit my scenario. I have a legacy db that stores 6 file names in 6 different fields - Whilst I haven't tried it, I'm assuming your video regarding multiple file uploads stores the file names as a CSV list in a single field?

Watching your update/upload file video, it deals with one file only and you have to create a condition to ensure the file name isn't overwritten in the event that you do not upload a file. BTW your condition of error == 4 didn't work for me at all. If I didn't upload a file, it wrote a 'blank' to the column. Changing the condition to .isFile worked as expected with or without an upload.

I tried to add other conditions (to cater for multiple file upload fields) with no success. Can you tell me the best way to have 2 or more file upload fields on an update form? Also, really looking forward to the resize on upload - an absolute must!

Replies

Replied 09 Nov 2015 08:28:47
09 Nov 2015 08:28:47 Teodor Kuduschiev replied:
Hello,
Our multi-upload with insert/update action tutorials show how to insert/update multiple database records (not stored in the same field).
I am not sure what exactly do you mean by: condition of error == 4 didn't work for me at all. Are you sure you applied the condition on the right place, followed by the same steps as shown in the tutorial?

Also could you please what exactly do you need to achieve as your explanation is a little confusing?
Replied 09 Nov 2015 08:40:19
09 Nov 2015 08:40:19 User  replied:
Hi Teodor, sorry if I have confused you.

1. A single row (or record) has fields, img1, img2, img3, img4, img5 & img6. All are varchar. I want to store the names of 6 uploaded images into those fields (single record) and of course upload the files at the same time. So I want 6 file upload fields on the same form.

2. In your video www.dmxzone.com/go/23317/use-html5-file-upload-with-update-record-server-action - you add a condition - I followed the video religiously and put the condition in the correct place and had the 2 update record behaviours in the correct place. It didn't work for me. If I change the error condition to isFile and it worked perfectly for me.
Replied 10 Nov 2015 10:05:35
10 Nov 2015 10:05:35 Teodor Kuduschiev replied:
I don't understand why would you need a row with 6 different images fields, when it is more practical to have a table with your IDs and then a table for your images.
This way you can filter your images table and show only the images, assigned to a specific ID. Also this way you could have ONE upload field per record, allowing multi uploads.

As for the condition - i cannot tell what the issue is, until i see your code.
Replied 10 Nov 2015 10:32:17
10 Nov 2015 10:32:17 User  replied:
I have absolutely no idea what's wrong with you? And why you never read anyone's questions? Second line, initial enquiry legacy DB. I've taken over this system and the client won't change it. In an ideal world, I'd have an Aston Martin and live in Monte Carlo. If you can't provide a solution to my question, just say so, its really tiring.
Replied 10 Nov 2015 10:50:15
10 Nov 2015 10:50:15 Teodor Kuduschiev replied:
You have not explained that "the client won't change it".
I am trying to explain to you how to do it easier and how it is the right way to do this. That's why we call these databases "relational databases".
So - do you want to edit the records one at a time (updating the 6 images at time) on a separate update record page, or do you want to have a huge multi record update page where you can update all of your database records?
Replied 10 Nov 2015 11:35:52
10 Nov 2015 11:35:52 User  replied:
Hi Teodore, I don't need to explain any of my client relationships or jobs to you. FYI, I know all about referential integrity, normalisation and entity modelling - I used to teach it, so try not to be so patronising to your customers. All I have been contracted to do is put a responsive front end on the application. Whilst we're talking DBs, I have lodged a support query here www.dmxzone.com/support/21863/topic/60972/ on one of my DBs which is fully normalised and has referential integrity. No one has responded to that. When I was in the military we had a saying RTFQ, ATFQ. The facility to update multiple records simultaneously in this system is not required. The client will only ever edit one record at a time.
Replied 10 Nov 2015 12:46:45
10 Nov 2015 12:46:45 Teodor Kuduschiev replied:
Well, just FYI this is not the army and will never be, so military sayings are not something we are discussing or following here.
I am asking questions, as your initial query was not clear, and just sounds absurd. And no one is "patronizing" nobody - i am trying to explain to you which is the best way to achieve something, as i see that you are doing it wrong. Actually it is you who mentioned your client relations, not me...
So if you only need to update one record at time - add 6 upload fields, 6 uploads and 6 update action steps attached to each of them .... Just as explained in the tutorial for a single file field.
As for your other question - sorry, but our support guys have somehow missed it. We will reply to it asap.
Replied 10 Nov 2015 13:25:20
10 Nov 2015 13:25:20 User  replied:
Teodore, I know I can add six upload controls to the page. I want to do it such a way that any existing filenames in the fields are not overwritten on update if no image is uploaded in that field. As I explained your update video shows that you need a condition to ensure that does not happen. with one file it is straight forward. With 6 files I can see that will be very difficult to implement in the way your video depicts it. These images are meaningful therefore it is possible on an edit, that img3 may be updated only, another time, img1 and img 6 could be updated, another time, img1, img2 and img4 updated and so on. I need to ensure that on any update, only the fields that get 'changed' are affected. Every Image field always has an image in it. Other controls that I have used do not touch the field if there is nothing uploaded. Unfortunately yours does. Not a problem with one image, nightmare logic with 6 images I think? But you may know a way round it which is what I'm trying to determine.
Replied 10 Nov 2015 13:53:45
10 Nov 2015 13:53:45 Teodor Kuduschiev replied:
That is what i am trying to explain - there are two options to achieve this.

1. Create 6 upload fields followed by 6 different update steps inside 6 different conditions for each upload field. So on executing the action you have
- fileField1 -> Check if empty -> then -> do not update -> else -> update inserts new filename
followed by
- fileField2 -> Check if empty -> then -> do not update -> else -> update inserts new filename

2. Create two separate tables, as i already suggested.

Reply to this topic