Note: I have posted the on the forum but not really received a lot of
help or a solution to this yet.
Can someone Please help me with this. I have been trying to work this
out for hours with no success.
I tried uploading a single file and that worked fine. However when I
then try and upload multiple files then the result is nothing. No
error and no file upload.
See my view that makes the form.
<?php echo form_tag('@upload_photo', 'multipart=true') ?>
<?php echo input_hidden_tag('user_id', $sf_user->getProfile()-
>getUserId()); ?>
<fieldset>
<legend>Upload Photos</legend>
<div class="form-row">
<?php echo label_for('album_parent_id', 'Parent Album') ?>
<?php echo select_tag('album_parent_id',options_for_select(
GalleryAlbumTools::nested_dropdown_albums($sf_user->getProfile()-
>getUserId()),
$sf_params->get('album_parent_id'),
'include_blank=true'
)) ?>
</div>
<?php for($i=1; $i <= 5; $i++): ?>
<div class="form-row">
<?php echo label_for('newFile', 'File:') ?>
<?php echo input_file_tag('newFile[]') ?>
</div>
<?php endfor; ?>
<div>
<?php echo submit_tag('Upload file') ?>
</div>
</fieldset>
</form>
And the resulting action
/**
* Execute Action Upload photo
*
*/
public function executeUpload()
{
if ($this->getRequest()->getMethod() != sfRequest::POST)
{
return sfView::SUCCESS;
}
else
{
if ($this->getRequest()->hasFiles())
{
foreach ($this->getRequest()->getFileNames() as $fileName)
{
//$this->logMessage(' uploaded image: '.
print_r($fileName),'err');
$fileSize = $this->getRequest()->getFileSize($fileName);
$fileType = $this->getRequest()->getFileType($fileName);
$fileError = $this->getRequest()->hasFileError($fileName);
$fileRealName = $this->getRequest()->getFileName($fileName);
$uploadDir =
sfConfig::get('sf_upload_dir').sfConfig::get('app_gallery_picture_folder').
DIRECTORY_SEPARATOR . $fileName;
//$uploadDir = sfConfig::get('sf_upload_dir');
$this->getRequest()->moveFile($fileName, $uploadDir);
} // end foreach
$this->setFlash('class', 'confirmation');
$this->setFlash('msg', 'Your images have been successfully
uploaded');
$this->redirect('@photo_management');
} // end if file uplaods
} // end if else
} // end function executeUpload
What is it I am doing wrong?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"symfony users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at
http://groups.google.com/group/symfony-users?hl=en
-~----------~----~----~----~------~----~------~--~---