Skip to content
This repository has been archived by the owner on Aug 1, 2024. It is now read-only.

Commit

Permalink
Fixed HTML5 single upload regression Fixes #17076
Browse files Browse the repository at this point in the history
git-svn-id: http://svn.dojotoolkit.org/src/dojox/trunk@31370 560b804f-0ae3-0310-86f3-f6aa0a117693
  • Loading branch information
Mike Wilcox committed Apr 28, 2013
1 parent 178a226 commit bb007ff
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 5 deletions.
2 changes: 1 addition & 1 deletion form/Uploader.js
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ define([

_getFileFieldName: function(){
var name;
if(this.supports("multiple")){
if(this.supports("multiple") && this.multiple){
name = this.name+"s[]";
}else{
// <=IE8
Expand Down
19 changes: 16 additions & 3 deletions form/tests/UploadFile.php.disabled
Original file line number Diff line number Diff line change
Expand Up @@ -146,14 +146,16 @@ if( isset($_FILES[$fieldName]) || isset($_FILES['uploadedfileFlash'])){
// Multiple files have been passed from HTML
//
$cnt = 0;
trace("HTML multiple POST:");
trace("IFrame multiple POST:");
trace($postdata, true);

$_post = $htmldata;
$htmldata = array();



while(isset($_FILES['uploadedfile'.$cnt])){
trace("HTML multiple POST");
trace("IFrame multiple POST");
$moved = move_uploaded_file($_FILES['uploadedfile'.$cnt]['tmp_name'], $upload_path . $_FILES['uploadedfile'.$cnt]['name']);
trace("moved:" . $moved ." ". $_FILES['uploadedfile'.$cnt]['name']);
if($moved){
Expand All @@ -173,11 +175,16 @@ if( isset($_FILES[$fieldName]) || isset($_FILES['uploadedfileFlash'])){
$_post['width'] = $width;
$_post['height'] = $height;
$_post['type'] = $type;
$_post['uploadType'] = $postdata['uploadType'];
$_post['size'] = filesize($file);
$_post['additionalParams'] = $postdata;
trace($_post, true);
trace($_post['additionalParams'], true);

$htmldata[$cnt] = $_post;

foreach($postdata as $key => $value){
//$htmldata[ $key ] = $value;
}

}elseif(strlen($_FILES['uploadedfile'.$cnt]['name'])){
$htmldata[$cnt] = array("ERROR" => "File could not be moved: ".$_FILES['uploadedfile'.$cnt]['name']);
Expand Down Expand Up @@ -286,8 +293,14 @@ if( isset($_FILES[$fieldName]) || isset($_FILES['uploadedfileFlash'])){
$htmldata['width'] = $width;
$htmldata['height'] = $height;
$htmldata['type'] = $type;
$htmldata['uploadType'] = $uploadType;
$htmldata['size'] = filesize($file);
$htmldata['additionalParams'] = $postdata;

$data = $json->encode($htmldata);
trace($data);
print $data;
return $data;


}elseif(isset($_GET['rmFiles'])){
Expand Down
2 changes: 1 addition & 1 deletion form/tests/test_Uploader.html
Original file line number Diff line number Diff line change
Expand Up @@ -169,7 +169,7 @@ <h1>Test dojox/form/Uploader</h1>
<form method="post" action="UploadFile.php" id="myForm" enctype="multipart/form-data" >
<fieldset>
<legend>Block Browse Button Form Post Test</legend>
<input class="browseButton" data-dojo-props='name:"uploadedfile", multiple:true, force:"iframe", label:"Select Some Files", isDebug:true' type="file" data-dojo-type="dojox/form/Uploader" id="uploader"/>
<input class="browseButton" data-dojo-props='name:"uploadedfile", multiple:true, force:"html5", label:"Select Some Files", isDebug:true' type="file" data-dojo-type="dojox/form/Uploader" id="uploader"/>
<input type="text" name="album" value="Summer Vacation" aria-label="album" />
+ <input type="text" name="year" value="2011" aria-label="year" />
<input type="button" id="remBtn" label="Clear" data-dojo-type="dijit/form/Button" />
Expand Down

0 comments on commit bb007ff

Please sign in to comment.