Skip to content
This repository has been archived by the owner on Nov 25, 2020. It is now read-only.

Commit

Permalink
previous commit (#69597c9010cb41b77b2e76cc2aae5b46a6eb9e57) broke the…
Browse files Browse the repository at this point in the history
… ability to upload folder tree on FS now fixed
  • Loading branch information
thomasCresson committed Jul 24, 2013
1 parent 69597c9 commit 1616021
Showing 1 changed file with 22 additions and 24 deletions.
46 changes: 22 additions & 24 deletions core/src/plugins/uploader.jumploader/class.JumploaderProcessor.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ public function preProcess($action, &$httpVars, &$fileVars){
$destStreamURL = $streamData["protocol"]."://".$repository->getId().$dir;
$fileHash = md5($httpVars["fileName"]);

if(self::$remote){
if(!self::$remote){
$resumeIndexes = array ();
$it = new RecursiveIteratorIterator(new RecursiveDirectoryIterator($destStreamURL));
$it->setMaxDepth(0);
Expand Down Expand Up @@ -245,22 +245,23 @@ public function postProcess($action, $httpVars, $postProcessData){
}
}
}
if( (!$all_in_place || $partitions_length != intval($fileLength))){
echo "Error: Upload validation error!";
/* we delete all the uploaded partitions */
if($httpVars["partitionCount"] > 1){
for($i = 0; $i < $partitionCount; $i++){
if(file_exists($destStreamURL."$fileHash.$fileId.$i")){
unlink($destStreamURL."$fileHash.$fileId.$i");
}

if( (!$all_in_place || $partitions_length != intval($fileLength))){
echo "Error: Upload validation error!";
/* we delete all the uploaded partitions */
if($httpVars["partitionCount"] > 1){
for($i = 0; $i < $partitionCount; $i++){
if(file_exists($destStreamURL."$fileHash.$fileId.$i")){
unlink($destStreamURL."$fileHash.$fileId.$i");
}
}
else{
$fileName = $httpVars["fileName"];
unlink($destStreamURL.$fileName);
}
return;
}
else{
$fileName = $httpVars["partitionRealName"];
unlink($destStreamURL.$fileName);
}
return;
}

if(count($subs) > 0 && !self::$remote){
$curDir = "";
Expand Down Expand Up @@ -308,14 +309,15 @@ public function postProcess($action, $httpVars, $postProcessData){
$count = intval($httpVars["partitionCount"]);
$fileId = $httpVars["fileId"];
AJXP_Logger::debug("Should now rebuild file!", $httpVars);
// Now move the final file to the right folder
// Currently the file is at the base of the current
AJXP_LOGGER::debug("PartitionRealName", $destStreamURL.$httpVars["partitionRealName"]);
$relPath = AJXP_Utils::decodeSecureMagic($httpVars["relativePath"]);
$target = $destStreamURL.$relPath;
$current = $destStreamURL.basename($relPath);

if($count > 1){
AJXP_LOGGER::debug("PartitionRealName", $destStreamURL.$httpVars["partitionRealName"]);
$relPath = AJXP_Utils::decodeSecureMagic($httpVars["relativePath"]);

$target = $destStreamURL.$relPath;
if(self::$remote){
$current = "/tmp/".basename($relPath);
$newDest = fopen("/tmp/".$httpVars["partitionRealName"], "w");
$newFile = array();
$length = 0;
Expand All @@ -340,12 +342,8 @@ public function postProcess($action, $httpVars, $postProcessData){
}

else{
// Now move the final file to the right folder
// Currently the file is at the base of the current
$current = $destStreamURL.basename($relPath);

$newDest = fopen($destStreamURL.$httpVars["partitionRealName"], "w");
$fileHash = md5($httpVars["fileName"]);
$fileHash = md5($httpVars["partitionRealName"]);

for ($i = 0; $i < $count ; $i++){
$part = fopen($destStreamURL."$fileHash.$fileId.$i", "r");
Expand Down

0 comments on commit 1616021

Please sign in to comment.