当有人将他们的简历上传到我的工作板时,他们似乎会在新闻申请后出现此错误。
Warning: fopen(/home/freelanc/public_html/wp-content/uploads/cv/2012/01/WebSiteBrief.doc) [function.fopen]: failed to open stream: No such file or directory in /nfs/c08/h02/mnt/115857/domains/freelancestudents.co.uk/html/wp-content/themes/freelance_v2/inc/php/swift/classes/Swift/ByteStream/FileByteStream.php on line 131
Fatal error: Uncaught exception 'Swift_IoException' with message 'Unable to open file for reading [/home/freelanc/public_html/wp-content/uploads/cv/2012/01/WebSiteBrief.doc]' in /nfs/c08/h02/mnt/115857/domains/freelancestudents.co.uk/html/wp-content/themes/freelance_v2/inc/php/swift/classes/Swift/ByteStream/FileByteStream.php:133 Stack trace: #0 /nfs/c08/h02/mnt/115857/domains/freelancestudents.co.uk/html/wp-content/themes/freelance_v2/inc/php/swift/classes/Swift/ByteStream/FileByteStream.php(77): Swift_ByteStream_FileByteStream->_getReadHandle() #1 /nfs/c08/h02/mnt/115857/domains/freelancestudents.co.uk/html/wp-content/themes/freelance_v2/inc/php/swift/classes/Swift/Mime/SimpleMimeEntity.php(660): Swift_ByteStream_FileByteStream->read(8192) #2 /nfs/c08/h02/mnt/115857/domains/freelancestudents.co.uk/html/wp-content/themes/freelance_v2/inc/php/swift/classes/Swift/Mime/SimpleMimeEntity.php(337): Swift_Mime_SimpleMimeEntity->_readStream(Object(Swift_ByteStream_FileByteStream)) #3 /nfs/c08/h02/mnt/115857/domains/freelancestud in /nfs/c08/h02/mnt/115857/domains/freelancestudents.co.uk/html/wp-content/themes/freelance_v2/inc/php/swift/classes/Swift/ByteStream/FileByteStream.php on line 133
我认为这个问题与此有关。
/** Get the resource for reading */
private function _getReadHandle()
{
if (!isset($this->_reader))
{
if (!$this->_reader = fopen($this->_path, 'rb'))
{
throw new Swift_IoException(
'Unable to open file for reading [' . $this->_path . ']'
);
}
fseek($this->_reader, $this->_offset, SEEK_SET);
}
return $this->_reader;
}
我将代码更改为此添加* ($ path = realpath('uploads /'))
/** Get the resource for reading */
private function _getReadHandle()
{
if (!isset($this->_reader))
{
if (!$this->_reader = fopen($path = realpath('uploads/')
{
throw new Swift_IoException(
'Unable to open file for reading [' . $this->_path . ']'
);
}
fseek($this->_reader, $this->_offset, SEEK_SET);
}
return $this->_reader;
但现在我得到一个Parse错误:语法错误,意外的'{'
答案 0 :(得分:0)
以递归方式将 wp-content / uploads 的目录权限设置为777。
如果您检查了按日期组织的上传内容,Wp会尝试每月制作一个新文件夹。一旦你进行了新的上传,他就会尝试制作一个新的文件夹而哈哈不能。
已解决:该网站被移至其他主机但已将绝对路径设置为旧主机。