[-] BO : fixed image upload (except with OVH firewall) #PSCFV-6152 #PSCFV-6157 #PSCFV-5862 #PSCFV-5756 #PSCFV-6074 #PSCFV-5459

This commit is contained in:
Damien Metzger
2012-12-17 15:45:40 +01:00
parent 1e7963ec12
commit 3d1663279a
2 changed files with 14 additions and 15 deletions
+5 -6
View File
@@ -162,14 +162,13 @@ class QqUploadedFileXhr
public function upload($path) public function upload($path)
{ {
$input = fopen('php://input', 'r'); $input = fopen('php://input', 'r');
$temp = tmpfile(); $target = fopen($path, 'w');
$realSize = stream_copy_to_stream($input, $temp);
fclose($input); $realSize = stream_copy_to_stream($input, $target);
if ($realSize != $this->getSize()) if ($realSize != $this->getSize())
return false; return false;
$target = fopen($path, 'w');
fseek($temp, 0, SEEK_SET); fclose($input);
stream_copy_to_stream($temp, $target);
fclose($target); fclose($target);
return true; return true;
+9 -9
View File
@@ -638,20 +638,20 @@ class AdminImportControllerCore extends AdminController
if (empty($field)) if (empty($field))
return array(); return array();
if (is_null(Tools::getValue('multiple_value_separator')) || trim(Tools::getValue('multiple_value_separator')) == '') $separator = Tools::getValue('multiple_value_separator');
if (is_null($separator) || trim($separator) == '')
$separator = ','; $separator = ',';
else
$separator = Tools::getValue('multiple_value_separator');
$temp = tmpfile(); do $uniqid = uniqid(); while (file_exists(_PS_UPLOAD_DIR_.$uniqid));
fwrite($temp, $field); $tmp_file = file_put_contents(_PS_UPLOAD_DIR_.$uniqid, $field);
rewind($temp); $fd = fopen($temp, 'r');
$tab = fgetcsv($temp, MAX_LINE_SIZE, $separator); $tab = fgetcsv($fd, MAX_LINE_SIZE, $separator);
fclose($temp); fclose($fd);
unlink($tmp_file);
if (empty($tab) || (!is_array($tab))) if (empty($tab) || (!is_array($tab)))
return array(); return array();
return $tab; return $tab;
} }
protected static function createMultiLangField($field) protected static function createMultiLangField($field)