Uploading a PDF file.
Uploading a PDF file.
I have generated a table using the online generator and am now trying to adapt it so that I can upload a PDF file, but at the moment, it will only accept image uploads. Am I missing something.?
**PHP**
->upload( Upload::inst( $_SERVER['DOCUMENT_ROOT'].'/upload/__ID__.__EXTN__' )
->db( '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( Validate::fileSize( 500000, 'Files must be smaller that 500K' ) )
->validator( Validate::fileExtensions( array( 'png', 'jpg', 'gif',pdf' ), "Please upload" ) )
)
)
->process( $_POST )
->json();
**JS**
{
data: "file",
render: function ( file_id ) {
return file_id ?
'<img src="'+editor.file( 'files', file_id ).web_path+'"/>' :
null;
},
defaultContent: "No image",
title: "Image"
}
This discussion has been closed.
Replies
Missing single quote.
No, that didn't help.
What happens when you upload a pdf file? What error message do you get - if any?
Allan
I managed to solve the problem by refreshing the page again. It was a typo area in the code, as mentioned by tangerine. Thanks for the assistance.