只是想知道是否有人可以帮助我,我想在我们的公司网站上添加两个以上的部分,这将允许我们让人们上传多个附件。有人可以帮忙吗?
<?php
/**
* @package
* @copyright Copyright (c)2010
* @license GNU General Public License version 2, or later
*/
defined('_JEXEC') or die('Restricted access'); // {}
if($this->config->allow_unsolicited == 0) die(JText::_('UNSOLAPPL_NOT_ALLOWED'));
?>
<?php $layout = JRequest::getVar('lyt', ''); ?>
<?php if($this->errors > 0) : ?>
<?php $option='com_jobboard'; $app= JFactory::getApplication(); ?>
<?php $fields = $app->getUserState('fields'); ?>
<?php endif; ?>
<?php $req_marker = '*'; ?>
<?php $path = 'index.php?option='. $option.'&view=upload&task=uload'; ?>
<form method="post" action="<?php echo JRoute::_($path); ?>" id="applFRM" name="applFRM" enctype="multipart/form-data">
<div id="aplpwrapper">
<?php echo JText::_('UPLOAD_CV_RESUME'); ?>
<h3><?php echo JText::_('UNSOLICITED_SUBMISSION'); ?></h3>
<div id="contleft">
<p><strong><?php echo JText::_('NOTE') ?>: </strong><?php echo JText::_('UNSOLICITED_CV_NOTIFICATION'); ?></p>
<div class="controw">
<label for="first_name"><?php echo JText::_('FIRSTNAME'); ?><span class="fieldreq"><?php echo $req_marker; ?></span></label>
<input class="inputfield " maxlength="20" id="first_name" name="first_name" size="50" value="<?php echo ($this->errors > 0)? $fields->first_name: ''; ?>" type="text" />
</div>
<div class="controw">
<label for="last_name"><?php echo JText::_('LASTNAME'); ?><span class="fieldreq"><?php echo $req_marker; ?></span></label>
<input class="inputfield " maxlength="20" id="last_name" name="last_name" size="50" value="<?php echo ($this->errors > 0)? $fields->last_name: ''; ?>" type="text" />
</div>
<div class="controw">
<label for="email"><?php echo JText::_('EMAIL_ADDRESS'); ?><span class="fieldreq"><?php echo $req_marker; ?></span></label>
<input class="inputfield " maxlength="50" id="email" name="email" size="50" value="<?php echo ($this->errors > 0)? $fields->email: ''; ?>" type="text" />
</div>
<div class="controw">
<label for="tel"><?php echo JText::_('TELEPHONE'); ?><span class="fieldreq"><?php echo $req_marker; ?></span></label>
<input class="inputfield " maxlength="50" id="tel" name="tel" size="50" value="<?php echo ($this->errors > 0)? $fields->tel: ''; ?>" type="text" />
</div>
<div class="controw">
<label for="title"><?php echo JText::_('CV_RESUME_TITLE'); ?><span class="fieldreq"><?php echo $req_marker; ?></span></label>
<input class="inputfield " id="title" name="title" size="50" maxlength="50" value="<?php echo ($this->errors > 0)? $fields->title: ''; ?>" type="text" />
</div>
<div class="rowsep"> </div>
<div class="controw">
<div class="uplrow">
<label for="cv"><?php echo JText::_('CV_RESUME'); ?><span class="fieldreq"><?php echo $req_marker; ?></span></label>
<input class="inputfield " maxlength="199" name="cv" id="cv" size="38" type="file" />
</div>
<div id="fslabel">
<small><strong><?php echo JText::_('NB'); ?>:</strong><?php echo ' '.JText::_('UPLOAD_ONLY_FORMATTYPES'); ?></small>
</div>
</div>
<div class="rowsep"> <h4><?php echo JText::_('OPTIONAL') ?></h4>
<label for="cover_text"><?php echo JText::_('COVER_NOTE') ?></label> <br /><small><?php echo JText::_('COVER_NOTE_HINT'); ?>:</small>
<textarea rows="4" id="cover_text" cols="" name="cover_text" style="float: right; margin-right: 12%; width: 47%;padding-top:5px" ><?php echo ($this->errors > 0)? $fields->cover_note: ''; ?></textarea>
</div>
<div align="center" style="clear: both; padding-top: 15px">
<span id="loadr" class="hidel"></span><input id="submit_application" name="submit_application" value=" <?php echo JText::_('SUBMIT_APPLICATION') ?> " class="button" type="Submit">
<?php $show_list='index.php?option='. $option.'&view=list&catid=1&lyt='.$layout; ?>
<a href="<?php echo JRoute::_($show_list); ?>"><?php echo JText::_('BACK'); ?></a>
</div>
</div>
</div>
<input name="form_submit" value="submitted" type="hidden">
<input name="catid" value="<?php echo $this->catid; ?>" type="hidden">
<?php echo JHTML::_('form.token'); ?>
</form>
<?php echo $this->setstate; ?>
答案 0 :(得分:3)
只需将代码从第45行复制到第53行:
<div class="controw">
<div class="uplrow">
<label for="cv"><?php echo JText::_('CV_RESUME'); ?><span class="fieldreq"><?php echo $req_marker; ?></span></label>
<input class="inputfield " maxlength="199" name="cv" id="cv" size="38" type="file" />
</div>
<div id="fslabel">
<small><strong><?php echo JText::_('NB'); ?>:</strong><?php echo ' '.JText::_('UPLOAD_ONLY_FORMATTYPES'); ?></small>
</div>
</div>
尽可能多的时间(例如2)。
并更改
name="cv"
到
name="cv[]"
然后当您处理提交时,只需使用$ _FILES ['cv']作为数组。 有关详细信息,请参阅官方PHP文档: