File upload error 'A server error occurred while uploading the file'
File upload error 'A server error occurred while uploading the file'
Koen Verhoeven
Posts: 25Questions: 7Answers: 0
in Editor
I've been trying to create a simple single file upload. But I keep getting the error 'A server error occurred while uploading the file'
My js file contains the following code where the table name is called 'deenk_files' and the primary key of the table is file_id
{
label: "Image:",
name: "image",
type: "upload",
display: function ( file_id ) {
return '<img src="'+editor.file( 'deenk_files', file_id ).web_path+'"/>';
},
clearText: "Clear",
noImageText: 'No image'
}
My php file contains the following code.
Field::inst( 'image' )
->setFormatter( Format::ifEmpty( null ) )
->upload( Upload::inst( 'D:\data/test.png' )
->db( 'deenk_files', 'file_id', array(
'filename' => Upload::DB_FILE_NAME,
'filesize' => Upload::DB_FILE_SIZE,
'web_path' => Upload::DB_WEB_PATH,
'system_path' => Upload::DB_SYSTEM_PATH
) )
)
Any idea what is going wrong here?
This question has an accepted answers - jump to answer
This discussion has been closed.
Answers
You need to check your server error logs to see exactly what the error is.
The only error I can find is the following
Which is strange since I'm not using sqlite at this point.
At line 36 I found the following code:
That doesn't appear to be the code with publish for the Editor PHP libraries. I'm not at all sure where that
sqlite_query
function is defined. Is that one of your own, or some other third party libraries?For the upload, when you upload the file, what does the server respond with (the browser's network inspector tools will show you).
Allan
It is a third party library I use as part of the website where I also use datatables. The only errors I get are:
A server error occurred while uploading the file
and the server is showing:
SQLite3::query(): Unable to prepare statement: 1, incomplete input in \Kaartviewer\sqlite3\sqlite3.php on line 36
Any other errors I did not find.
So if I understand correctly the script for the file upload tries to use an existing function with the same name from the third party library? Any idea in which direction I have to look?
I would start with a test case which excludes the third-party library. That should immediately tell you whether this is a DataTables problem.
Sorry for the late reply, I missed the email notification with your answer.
You are totally right. When creating a complete new table with the generator, and trying it again, it works perfectly.