ssi-uploader icon indicating copy to clipboard operation
ssi-uploader copied to clipboard

without ajax post

Open Profile opened this issue 8 years ago • 7 comments

why we cannot get data submit form or how should we do? I want when form submit this input will upload Thanks

Profile avatar Jan 24 '17 22:01 Profile

ss-uploader doesn't support form submit for now. I will consider to add this feature in the next release.

ssbeefeater avatar Jan 25 '17 10:01 ssbeefeater

@ssbeefeater I have downloaded last version and it seems it still does not support it. I need to send the images together with the whole form data.

This is a feature that is basic to have because the more common use case is precisely that. I cannot imagine a real world page that allows to store images in server disk without associating it to anything. Normally that image should be associated to other entity, for example, customer, invoice, process, etc. And to accomplish that, entity should be saved together with the image.

Regards Jaime

jaimestuardo avatar May 04 '19 01:05 jaimestuardo

try to use inForm prop also you can use data prop to pass any extra data with the uploaded files check available options here. If these doesnt fit your needs let me know

ssbeefeater avatar May 04 '19 01:05 ssbeefeater

Hello, I think the problem is that I am posting the form using AJAX call. So I was thinking about other alternative.

Posting the form as it is, and returning the ID of the entity the images will be assigned to. However, I need to make your plugin to upload the files upon some method call. However, I did not find any method to upload the files or I did not find in the docs at least.

Have you considered implementing such a method? do you have other suggestion?

Thanks

jaimestuardo avatar May 04 '19 23:05 jaimestuardo

@ssbeefeater Hello... I am trying to make uploadFiles method public so that I can call from the page after the entity is saved, but no success. Can you help me, please?

jaimestuardo avatar May 05 '19 03:05 jaimestuardo

@ssbeefeater I could finally call uploadFiles method after the entity has been saved, however, I encountered another critical problem. "data" property of ssi_uploader cannot be dynamic. I need to pass the current ID returned from database, but the "data" property is fixed having the value when the object was initialized.

I was looking at the beforeUpload method, but the example you wrote only shows how to send a notification. Is there a way to modify "data" property from beforeUpload event?

Thanks Jaime

jaimestuardo avatar May 05 '19 06:05 jaimestuardo

Finally, I have modified ssi-uploader.js to allow "data" property to be dynamic, this way;

          $.each(thisS.options.data, function (key, value) {
                if (typeof value == 'function')
                    value = value();
                formData.append(key, value);
            });

That way, if "data" parameter is a function, that is called instead of assigning the value.

I think you could consider all these changes to your plugin.

Regards Jaime

jaimestuardo avatar May 06 '19 02:05 jaimestuardo