Help to build a right logic process

Your opinion and your experience is required, please.

Imagine a "create form" with only five fields, connected to a table, of course. One of thise is an upload field.

(id)

  • Photo (upload)

  • Address

  • Lat

  • Lng

  • Description

The user input would work with this logic:

The user upload a file and a routine immediatly checks some conditions. Complex conditions, not only "required" or some check format, but, for example, extract some exif data from the uploaded file, check if there are geotag data and if they are valid. If yes, write lat and lng fields, fill address with a geocoding routine. The description field must not be empty. At this point the record can be saved.

If not, the user must fill the Address field and, after geocoding routine, the lat and lng will be written. After writing description field too, the user can save the record.

If not, the user must manually insert lat, lng and description fields. A reverse geocodin routine will fill the address field, and then the record can be saved.

It is possible do all this in only one form or it will be better, after one or more failed conditions, open an other form?

Wher I must intercept the event after the user filled one field?

This mine approach is wrong? How would you do?

It sounds like you should allow them to upload the image first, then prompt them to complete the missing fields in a separate form. Make only the uploaded file required for the insert scenario, then make the other fields required on update.

I imagine that the photo should not be changed after the insert, so you would probably show a thumbnail on the second form, but no upload field. You might also offer an option to delete the photo and start again.

You can do much of this over AJAX in modern browsers (even file upload) using FormData, so you might want to offer that if their browser supports it.

EDIT:

Here are the browsers that should support the FormData object.

Good point to start. After file upload where it will be better intercept the event to run a function?