简体   繁体   English

在joomla中上传后将文件路径保存到数据库中

[英]saving file path into database after uploading in joomla

i'm now creating my own component in joomla 2.5.14. 我现在在joomla 2.5.14中创建自己的组件。 i had uploaded files from back end. 我已经从后端上传了文件。 but i cant store the file path into the database. 但我无法将文件路径存储到数据库中。 other column values are updating but the column for uploaded file is not updating. 其他列值正在更新,但上载文件的列未更新。 it remains null. 它保持为空。 below shown is the line i used to update values in the db. 下面显示的是我用于更新数据库中值的行。

$row =& JTable::getInstance('tenders', 'Table');
if(!$row->bind(JRequest::get('post')))
{
    JError::raiseError(500, $row->getError() );
}
    $row->uploaded=JRequest::getVar( $filepath, '','post', 'string', JREQUEST_ALLOWRAW );

    if(!$row->store()){
    JError::raiseError(500, $row->getError() );
}

my file uploading is working perfectly. 我的文件上传正常。 help me to add the path to db using JTable store or bind functions because i use the same for updating other columns. 帮助我使用JTable存储或绑定功能将路径添加到db,因为我将其用于更新其他列。

i solved the problem. 我解决了这个问题。 i changed the line 我换了线

$row->uploaded=JRequest::getVar( $filepath, '','post', 'string', JREQUEST_ALLOWRAW );

as

$row->uploaded=$filepath;

then it works well.. 那就很好用了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM