Hi,
I’ve created a cell in a grid with an upload button:
mygrid.attachEvent(“onRowCreated”, function(id){
mygrid.cells(id,10).setValue(‘<form action=php/dhtmlxform_item_upload.php?Unique_ID=VARIABLE-X method=“post” target=“dummyframe” enctype=“multipart/form-data”>’);
Now I need to pass a variable to the action part of the form (VARIABLE-X).
Is there a way to do this?
I would really aprecciate your help.
Can you please clarify the purpose of variable - is it just some global variable from the grid’s window or some row’s property?
In case of a common global var, you can change the URL dynamically, before submitting the form to the server side
mygrid.cells(id,10).setValue('<iframe style="display:none" name="dummyframe" id="dummyframe"></iframe><form method="post" target="dummyframe" enctype="multipart/form-data"><input type="file" name="fileToUpload" id="fileToUpload" onchange="form.action=\'php/dhtmlxform_item_upload.php?Unique_ID=\'+top.VARIABLEX; form.submit()"></form>');
Hi Stanislav,
That is exactly what I was looking for, to pass a general variable!
Thanks a lot!
Is it posible to obtain a variable with the name of the file once it was uploaded?
On server side just check $_FILES[“fileToUpload”] structure
On the client side, it is a bit more tricky, server-side code which handles file uploading can return back something similar to next
so on the client side, you will be able to check lastUploadedFile to get the name, timing and syncing values will be tricky anyway.
You can consider using a more complex solution for file uploading instead of a raw HTML input. Something like dhtmlxVault
dhtmlx.com/docs/products/dhtmlxVault/
So it is posible to attatch an element like vault or form uploader to a grid cell?
Could you guide me on how to attatch dhtmlxform uploader to a grid cell?
Thanks
You can’t attach vault to the grid’s row. But you can have vault or uploader somewhere on the page ( even in hidden container ), and have a plain html button in the row. On button click you can trigger js api of vault or uploader to start file selection and uploading process
Check forum.dhtmlx.com/viewtopic.php?f=17&t=61602