Upload with append fielddata
Upload with append fielddata
Andreas S.
Posts: 208Questions: 74Answers: 4
in Editor
Is it possible to send with the upload some fielddata with them and if the upload is success the modal windows close automatically? I read a Okt. 17 post that this is not possible but in the manual i read about ajaxdata with the append function.
I'm not sure what is now correct.
Is anywhere a example about ajaxdata and the append function?
Andreas
This discussion has been closed.
Answers
It sounds like
uploadXhrSuccess
is the event you want here. It will trigger when the upload is complete, and you could callsubmit()
if you then want to immediately submit and close the form.Allan
Is it possible to close the windows after upload?
Andreas
I need with the upload at the same time more Data about the file. For example File Description. The API of the Java Serverscript need all Data before the store the file and Data. A modify with edit is not possible, that is a security rule.
My first idea the upload should start with the submit button, but I did not find something about this. Now I try find out how can I send some more fields with the file upload. The preUpload is my event, but how did I add the form fields to the submission
Andreas
I'm also interested in that. I need to add a security nonce to the upload. On submit i can add it on "preSubmit". But this seems not to work on "preUpload".
It seems not possible to append an extra ajax field then?
How have you configured the Editor please? You can use
ajax.data
as a function and that will add information to the data to send to the server, including for upload.Allan
Hallo Allan,
The following works on 'preSubmit':
But this is not called when uploading an image. So i tried on 'preUpload'. That is called, but there the above scheme is not working:
So my temporary solution is, to change the datatables.editor.js around line 4222 and append the data there:
Just, for testing. But it worked. My problem is now, how to get this done in my own table scripts.
Also, for 'upload', "processData" needs to be set to false, but needs to be true on read, edit, delete, create.
I tried:
But this is not working - then ajax is not being sent at all.
It wouldn't no -
preUpload
is the correct event to use for this, but as noted there thedata
parameter is aFormData
object. For that you need to use itsappend
method rather than adding as you would with object notation for a plain object.Allan