I have a form with data such as name, address ... and another separate upload profile profile form. And I want to get this (optional) uploaded image when submitting a "parent" (separate) form.
Now they work as follows:
The uploaded pic is sent via .ajaxSubmit() to process_uploaded_image.php. Then it is processed, changed, and a new image is created in the "dump / tempo" folder. I could return it to success: function(data) , in the form of data, which could be an echo of $image_path_and_name or as <img src="$image_path_and_name"/> . I did it like this: I have a temporary image, since
(1) I want the user to look at what he just loaded (remember that I already have a return path or img element for jquery and I could place it wherever I want) and
(2) the uploaded image is not final until the parent form completes the registration. And yet this is a temporary image.
So the problem is that: I want to access the downloaded image and โbring itโ with the โparentโ form when it is sent ... how can I do this for sure? This is technically not a parent form, as I know that a form inside a form is not allowed. But he is tied logically under this parental form. I would be grateful for any help, but if possible, I would appreciate it even more if you could consider my current scenario, so I no longer have to start from scratch. Thanks again. My idea: (please let me know as much as possible ... and / or a guide on how I could do # 1)
1. "Restore" or copy this file from ajax-jquery, returned (data) line $image_path_and_name or <img src="$image_path_and_name"/> , put it in the final folder for downloading. <--- THIS WHERE I AM STOPPED! I could not just use move_uploaded_file() , can I?
2. Since everything is final from now on ... I can save its path to my database, as well as other form information.
3. Launch the dump / tempo folder.
source share