Skip to content

Commit

Permalink
web->receive multiple image name return fix
Browse files Browse the repository at this point in the history
Signed-off-by: fpumir <fpumir@terredeweb.fr>
  • Loading branch information
fpumir committed Feb 8, 2013
1 parent ac5a278 commit 6d7d92c
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions web.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ function receive($func=NULL,$overwrite=FALSE,$slug=TRUE) {
mkdir($dir,Base::MODE,TRUE);
if ($fw->get('VERB')=='PUT') {
$fw->write($dir.basename($fw->get('URI')),$fw->get('BODY'));
return basename($fw->get('URI'));
return array(basename($fw->get('URI')));
}
if ($fw->get('VERB')=='POST')
foreach ($_FILES as $item) {
Expand All @@ -146,9 +146,10 @@ function receive($func=NULL,$overwrite=FALSE,$slug=TRUE) {
}
else
$item=array($item);
$ret=array();
foreach ($item as $file) {
if (empty($file['name']))
return FALSE;
continue;
$base=basename($file['name']);
$imn=($slug && preg_match('/(.+)(\.\w+)$/',$base,$parts)?
$this->slug($parts[1]).$parts[2]:$base);
Expand All @@ -159,8 +160,9 @@ function receive($func=NULL,$overwrite=FALSE,$slug=TRUE) {
$func && !$fw->call($func,array($file)) ||
!move_uploaded_file($file['tmp_name'],$dst))
return FALSE;
$ret[]=$imn;
}
return $imn;
return $ret;
}
return FALSE;
}
Expand Down

0 comments on commit 6d7d92c

Please sign in to comment.