$_FILES is empty
$_FILES is empty
I'm new to DataTables.
Trying to get jEditable to work with serverside processing but can't get it to work.
[code]
$('#example').dataTable({
"bProcessing" : true,
"bServerSide" : true,
"sAjaxSource" : "../man_hw.php?title=view",
"aoColumns":[
{
"bVisible" : false
},
{"sType": "string"},
{"sType": "string"},
{"sType": "string"},
{sTitle:'', sWidth:'10px', sClass:'tableThumbnailCell', bSortable:false}
]
}).makeEditable({
sAddNewRowFormId: "formAddNewRow",
sAddNewRowButtonId: "btnAddNewRow",
sAddNewRowOkButtonId: "btnAddNewRowOk",
sAddNewRowCancelButtonId: "btnAddNewRowCancel",
sDeleteRowButtonId: "btnDeleteRow",
"aoColumns": [
null,
{"sType": "string"},
{"sType": "string"},
{"sType": "string"},
{sTitle:'', sWidth:'10px', sClass:'tableThumbnailCell', bSortable:false}
],
sUpdateURL : '../man_hw.php?title=update',
sAddURL : "../man_hw.php?title=add",
sDeleteURL : "../man_hw.php?title=del"
.......
});
Delete
Add
Cancel
Aggiungir
Tipo
Descrizione
Posizione
Immagine
id
Tipo
Descrizione
Posizione
Thumb
id
Tipo
Descrizione
Posizione
Thumb
[/code]
php file
[code]
if((isset($_FILES['value']['error']) && $_FILES['value'] == 0) ||
(!empty($_FILES['value']['tmp_name']) && $_FILES['value']['tmp_name'] != 'none')) {
if (0 == @filesize($_FILES['value']['tmp_name'])) {
error_log ("Empty or invalid file.");
die();
}
error_log ("File Name: " . $_FILES['value']['name']);
error_log (" File Size: " . @filesize($_FILES['value']['tmp_name']));
//for security reason, we force to remove all uploaded file
@unlink($_FILES['value']);
} else {
error_log ("No file has been uploaded.");
die();
}
[/code]
I tried the form without the datatable and it works. If I use jquery-datatables-editable form does not work the same. Can you help?
Trying to get jEditable to work with serverside processing but can't get it to work.
[code]
$('#example').dataTable({
"bProcessing" : true,
"bServerSide" : true,
"sAjaxSource" : "../man_hw.php?title=view",
"aoColumns":[
{
"bVisible" : false
},
{"sType": "string"},
{"sType": "string"},
{"sType": "string"},
{sTitle:'', sWidth:'10px', sClass:'tableThumbnailCell', bSortable:false}
]
}).makeEditable({
sAddNewRowFormId: "formAddNewRow",
sAddNewRowButtonId: "btnAddNewRow",
sAddNewRowOkButtonId: "btnAddNewRowOk",
sAddNewRowCancelButtonId: "btnAddNewRowCancel",
sDeleteRowButtonId: "btnDeleteRow",
"aoColumns": [
null,
{"sType": "string"},
{"sType": "string"},
{"sType": "string"},
{sTitle:'', sWidth:'10px', sClass:'tableThumbnailCell', bSortable:false}
],
sUpdateURL : '../man_hw.php?title=update',
sAddURL : "../man_hw.php?title=add",
sDeleteURL : "../man_hw.php?title=del"
.......
});
Delete
Add
Cancel
Aggiungir
Tipo
Descrizione
Posizione
Immagine
id
Tipo
Descrizione
Posizione
Thumb
id
Tipo
Descrizione
Posizione
Thumb
[/code]
php file
[code]
if((isset($_FILES['value']['error']) && $_FILES['value'] == 0) ||
(!empty($_FILES['value']['tmp_name']) && $_FILES['value']['tmp_name'] != 'none')) {
if (0 == @filesize($_FILES['value']['tmp_name'])) {
error_log ("Empty or invalid file.");
die();
}
error_log ("File Name: " . $_FILES['value']['name']);
error_log (" File Size: " . @filesize($_FILES['value']['tmp_name']));
//for security reason, we force to remove all uploaded file
@unlink($_FILES['value']);
} else {
error_log ("No file has been uploaded.");
die();
}
[/code]
I tried the form without the datatable and it works. If I use jquery-datatables-editable form does not work the same. Can you help?
This discussion has been closed.
Replies
From what I can tell if you had a working version of a form with an input file type uploading, then added datatables to it, your no longer playing with the same stuff. Your in Ajax world now, technically your form has been high-jacked by the plugin and it (datatables) needs to handle it or be extended to handle it (i'd prefer the first). But I don't see that build into it. So What i'm going to try to look into is the send portion.
the idea here is: datatables needs an ajax uploader installed with it. I'm not sure where that might be implemented. I know there are hooks that maybe DT can handle before it sends.
this doesn't look like a pretty/easy answer, If anyone has any Idea would love to hear one.
just thinking out loud here:
http://editor.datatables.net/options/
This appears to have events such as onPreSubmit. Maybe I can attach an ajax uploader at this point and see if it sends successfully. but all in all I need to make sure that I can handle the file data aka $_FILES, where the rest of my data is going aka $_POST. I would really like a way to keep it all in one submit.
well anyhow I'll post back if I come up with something and Still hoping that someone else has an idea for this.
I think there are slightly crossed wires in the direction of the thread - @esoul7 was looking at the Editable plug-in which is a 3rd party bit of software, and I can't provide any help with that since I'm not familiar with it.
However @dwoodard it sounds like you are looking at the Editor plug-in for DataTables which is very much supported as part of the DataTables core framework.
You are absolutely correct in your assumption that the issue here is the Ajax submit of the form. Ajax typically doesn't play nicely with file uploads.
There are three possible options that I can see off the top of my head:
1. A new option is introduced into Editor to allow direct submission of the form, rather that doing an Ajax request. Possibly this could be done by firing an event - which I suspect would be the cleanest implementation.
2. A 'file' input plug-in could be created which uses Flash, or iFrames or whatever to submit the form.
3. Editor could provide an iFrame option built in.
I think I prefer option 1 the most, since the other two can then be directly implemented using that method (the code wouldn't be built in, but the option would be available for those who want it, and those who don't wouldn't have that code weight).
This sounds like an ideal option to do into Editor 1.1.
@dwoodard - does this sound like a suitable solution to what you are looking for?
Regards,
Allan
At this point in my task any 3 of these will be useful. In the long run of the process here, I think firing an event is the best way to go.
I felt a little bit like inception here: a plugin within a plugin within a plugin! knowing where the scope was got difficult and time didn't slow down to make that more easier :)
Work on Editor 1.1 is underway, and I'll make sure that this option goes in. Thanks for the feedback!
Regards,
Allan
I really haven't found a solution.
Has anybody found one ?
If so I'd love to have it explained to me !
I notice that your trial of Editor is now complete. How have you found it? If you have any feedback on Editor, it is always welcome.
Allan