Unknown upload field name submitted
Unknown upload field name submitted
Seppelchen
Posts: 69Questions: 25Answers: 1
If I select a file i can see: Unknown upload field name submitted
If I select a file i will upload i can see: Unknown upload field name submitted
on upload-many.php we had write:
<?php
/*
* Example PHP implementation used for the index.html example
*/
// DataTables PHP library
include( "../php/DataTables.php" );
// Alias Editor classes so they are easy to use
use
DataTables\Editor,
DataTables\Editor\Field,
DataTables\Editor\Format,
DataTables\Editor\Mjoin,
DataTables\Editor\Upload,
DataTables\Editor\Validate;
// Build our Editor instance and process the data coming from _POST
Editor::inst( $db, 'datenpflege_lieferanten' )
->fields(
Field::inst( 'liefnr' ),
Field::inst( 'liefmc' ),
Field::inst( 'ansprechpartner' )
)
->join(
Mjoin::inst( 'datenpflege_files' )
->link( 'datenpflege_lieferanten.id', 'datenpflege_filesuploaded.lieferanten_id' )
->link( 'datenpflege_files.id', 'datenpflege_filesuploaded.file_id' )
->fields(
Field::inst( 'id' )
->upload( Upload::inst( $_SERVER['DOCUMENT_ROOT'].'/upload/__ID__.__EXTN__' )
->db( 'datenpflege_files', 'id', array(
'filename' => Upload::DB_FILE_NAME,
'filesize' => Upload::DB_FILE_SIZE,
'web_path' => Upload::DB_WEB_PATH,
'system_path' => Upload::DB_SYSTEM_PATH
) )
->validator( function ( $file ) {
return$file['size'] >= 50000 ?
"Files must be smaller than 50K" :
null;
} )
->allowedExtensions( [ 'png', 'jpg', 'pdf' ], "Please upload an image" )
)
)
)
->process( $_POST )
->json();
and on normal screen we had write:
var editor = new $.fn.dataTable.Editor( {
ajax: "DataTables/ServerSide/upload-many.php",
table: "#bilddatenbank",
fields: [ {
label: "Liefnr",
name: "liefnr"
}, {
label: "Images:",
name: "id",
type: "uploadMany",
display: function ( fileId, counter ) {
return '<img src="'+table.file( 'files', fileId ).web_path+'"/>';
},
noImageText: 'No images'
}
]
} );
This discussion has been closed.
Answers
This uploads the files with the name "id", but your PHP is configured to expect them in an MJoin instance. So, as the example shows you would use the MJoin name as well - for example it would probably be
datenpflege_files[].id
in this case.Allan
Hello, now i had apply change:
But if i try upload I can't see that it will upload i can't see any error but i can't also see any image who is uploaded...:'(
Have you checked your server's error log? If not, that is the first thing I would suggest doing.
Also, I would suggest checking your browser's console for any errors. If there are no errors there, inspect the Ajax request that the upload triggers and find out what the server is returning.
Allan
Hello, I had fix the path to upload folder now. But now I get this error:
TypeError: f.files[a] is undefined
http://***/DataTables/js/dataTables.editor.min.js
Line 54
I can't see any image but i can see table: datenpflege_files
get some entrys and table datenpflege_filesuploaded get also some entrys.
But than i can not re open this row if i try open i can see same error
TypeError: f.files[a] is undefined
http://***/DataTables/js/dataTables.editor.min.js
Line 54
And is there any possibility to display a loader while files are upload. That would be better for all.
Hope you can help on both cases.
Hello could anybody help? How we can fix that?
Hi,
The first parameter passed into
file()
should be the table name where the file information is. You are passing infiles
, but the table name is actuallydatenpflege_files
. I would suggest fixing that.I was going to login to the URLs you sent me by e-mail (thanks for them). However I get:
Just to let you know in case that doesn't fix the issue.
Thanks,
Allan
Hello Allan,
beautiful it helps. Now regarding my last question from previous post:
And is there any possibility to display a loader while files are upload. That would be better for all.
This should actually happen already. If the browser supports it (and not all do) a percentage upload complete will be shown. It is typically only shown briefly since the upload will normally happen quickly.
Allan
Hello, where it should display?
I cant see any proccess bar on upload form