{
if (isset($q['_remote_upload'])) {
require_once 'System.php';
- static $tmpdir = false;
- if (!$tmpdir) {
- $tmpdir = System::mktemp("-d remote_upload");
- }
+
+ $tmpdir = System::mktemp("-d remote_upload");
$path = $tmpdir . '/' . basename($q['_remote_upload']);
- $fetch = false;
+
if(!file_exists($path)){
- $fetch = true;
- // use HTTP_Request
file_put_contents($path, file_get_contents($q['_remote_upload']));
}
$imageInfo = getimagesize($path);
+
require_once 'File/MimeType.php';
$y = new File_MimeType();
$ext = $y->toExt(trim((string) $imageInfo['mime'] ));
if (!preg_match("/\." . $ext."$/", $path, $matches)) {
- rename($path,$path.$ext);
+ rename($path,$path.".".$ext);
+ $path.= ".".$ext;
}
if (!$this->createFrom($path)) {
- $roo->jerr("erro making image" . $q['_remote_upload'] . "??? " . ((int) $fetch));
+ $roo->jerr("erro making image" . $q['_remote_upload']);
}
$roo->addEvent("ADD", $this, $this->toEventString());
// direct via roo...
/// ctrl not used??
- function onUpload($ctrl)
+ function onUpload($roo)
{
if (empty($_FILES['imageUpload']['tmp_name']) ||
return; // standard update...
}
- if ( !$this->onUpload($this)) {
- $roo->jerr("File upload failed : ". $this->err);
+
+// print_r(!$this->onUpload($this));
+
+ if ( !$this->onUpload($this)) {
+ $roo->jerr("File upload failed : ". (!empty($this->err) ? $this->err : ''));
}
$roo->addEvent("ADD", $this, $this->toEventString());
return $this->filename .' - on ' . $this->ontable . ':' . $this->onid;
//$p->toEventString();
}
+
}