wird von upload-feld verwendet
186100
public function getFileInfo()
    {
        $ret = array(
            'uploadId' => $this->id,
            'mimeType' => $this->mime_type,
            'filename' => $this->filename,
            'extension'=> $this->extension,
            'fileSize' => $this->getFileSize(),
            'hashKey'  => $this->getHashKey()
        );
        if (!$this->id && is_file($this->filename)) {
            $ret['mimeType'] = $this->_getMimeType($this->filename);
            $ret['extension'] = substr(strrchr($this->filename, '.'), 1);
        }
        $size = $this->getImageDimensions();
        if ($size) {
            $ret['image'] = true;
            $ret['imageHandyScaleFactor'] = Kwf_Media_Image::getHandyScaleFactor($size);
            if (abs($size['rotation']) == 90) {
                $size = array('width'=>$size['height'], 'height'=>$size['width']);
            }
            $ret['imageWidth'] = $size['width'];
            $ret['imageHeight'] = $size['height'];
        } else {
            $ret['image'] = false;
        }
        return $ret;
    }
591079
function uploadByDir(src, dest, client) {
    ClientLib.scp(src, dest, client,
        function (err) {
            if (err) {
                console.log(err);
            }
        }
    );
}
362004
public function pluploadAction()
    {
        set_time_limit(5 * 60);
        //obiekt handlera plupload
        $pluploadHandler = new Model\PluploadHandler();
        //jeśli wystąpił błąd
        if (!$pluploadHandler->handle()) {
            return $this->_jsonError($pluploadHandler->getErrorCode(), $pluploadHandler->getErrorMessage());
        }
        //jeśli wykonać operację po przesłaniu całego pliku i zapisaniu rekordu
        if ($this->getPost()->afterUpload && null !== $record = $pluploadHandler->getSavedCmsFileRecord()) {
            $this->_operationAfter($this->getPost()->afterUpload, $record);
        }
        return json_encode(['result' => 'OK', 'cmsFileId' => $pluploadHandler->getSavedCmsFileId()]);
    }
39118
public function uploadFile()
    {
        if (!$this->request->files->has('file')) {
            return false;
        }
        $file   = $this->request->files->get('file');
        $upload = rtrim($this->uploadDir, '/');
        if (!is_dir($upload)) {
            mkdir($upload, 0777, true);
        }
        $file->move(realpath($upload), $file->getClientOriginalName());

        return sprintf('/%s/%s', pathinfo($upload, PATHINFO_BASENAME),
            pathinfo($file->getClientOriginalName(), PATHINFO_BASENAME));
    }
190681
public function upload()
    {
        if ($newFile = $this->getNewFileName()){
            $origin = $destination = \Devil::getPathOf($this->config['dest']);
            $this->remove();
            if (isset($this->config['onload'])) {
                $destination .= '/origin';
            }
            if (!is_dir($destination)) mkdir ($destination, 0777, true);
            $realFileName = $destination . '/' . $this->_primaryKey . '_' . $this->getNewFileName();
            if (move_uploaded_file($this->uploaded['tmp_name'], $realFileName)) {
                if (isset($this->config['onload'])) foreach ($this->config['onload'] as $method=>$config) {
                    $this->$method($realFileName, $origin, $config, $this->_primaryKey . '_' . $this->getNewFileName());
                }
            }
        }
    }
900782
protected function upload($args)
    {
        $target = $args['target'];
        $volume = $this->volume($target);
        $files  = isset($args['FILES']['upload']) && is_array($args['FILES']['upload']) ? $args['FILES']['upload'] : array();
        $result = array('added' => array(), 'header' => empty($args['html']) ? false : 'Content-Type: text/html; charset=utf-8');

        if (empty($files)) {
            return array('error' => $this->error(self::ERROR_UPLOAD, self::ERROR_UPLOAD_NO_FILES), 'header' => $header);
        }

        if (!$volume) {
            return array('error' => $this->error(self::ERROR_UPLOAD, self::ERROR_TRGDIR_NOT_FOUND, '#'.$target), 'header' => $header);
        }

        foreach ($files['name'] as $i => $name) {
            if (($error = $files['error'][$i]) > 0) {
                $result['warning'] = $this->error(self::ERROR_UPLOAD_FILE, $name, $error == UPLOAD_ERR_INI_SIZE || $error == UPLOAD_ERR_FORM_SIZE ? self::ERROR_UPLOAD_FILE_SIZE : self::ERROR_UPLOAD_TRANSFER);
                $this->uploadDebug = 'Upload error code: '.$error;
                break;
            }

            $tmpname = $files['tmp_name'][$i];

            if (($fp = fopen($tmpname, 'rb')) == false) {
                $result['warning'] = $this->error(self::ERROR_UPLOAD_FILE, $name, self::ERROR_UPLOAD_TRANSFER);
                $this->uploadDebug = 'Upload error: unable open tmp file';
                break;
            }

            if (($file = $volume->upload($fp, $target, $name, $tmpname)) === false) {
                $result['warning'] = $this->error(self::ERROR_UPLOAD_FILE, $name, $volume->error());
                fclose($fp);
                break;
            }

            fclose($fp);
            $result['added'][] = $file;
        }

        return $result;
    }
804266
public function doUpload()
    {
        $disk = \Storage::disk($this->getOption('disk'));
        $file = \Input::file('file');

        $ext = $file->getClientOriginalExtension() ?: $file->guessClientExtension();

        $filename = md5_file($file->getRealPath()).'.'.$ext;
        $put_path = trim($this->getOption('path'), ' /').'/'.$filename;

        if (!$disk->exists($put_path)) {
            $f_res = fopen($file->getRealPath(), 'r');
            $disk->put($put_path, $f_res);
            fclose($f_res);
        }

        return [
            'errors'        => [],
            'path'          => trim($put_path, '/'),
            'filename'      => trim($put_path, '/'),
            'original_name' => $file->getClientOriginalName(),
        ];
    }
556329
public function uploadChunk ()
		{
			move_uploaded_file($this->_file[ 'tmp_name' ], $this->chunkPath);

			Yii::$app->response->setStatusCode(200);
		}
801303
function upload(file_mngr_url, file, filename, success, error) {
    // Assemble data
    var fd = new FormData();
    fd.append("filename", filename);
    fd.append("file", file);
    var req = new XMLHttpRequest();
    req.open("POST", file_mngr_url + "/upload");
    req.onload = function(e) {
        var url = JSON.parse(req.response).url;
        if (url === undefined)
            error();
        else
            success(url);
    };
    req.send(fd);
}
1063645
def upload_simple(self, fd, filename, folder_key=None, path=None,
                      filedrop_key=None, action_on_duplicate=None,
                      mtime=None, file_size=None, file_hash=None):
        
        action = 'upload/simple'

        params = QueryParams({
            'folder_key': folder_key,
            'path': path,
            'filedrop_key': filedrop_key,
            'action_on_duplicate': action_on_duplicate,
            'mtime': mtime
        })

        headers = QueryParams({
            'X-Filesize': str(file_size),
            'X-Filehash': file_hash,
            'X-Filename': filename.encode('utf-8')
        })

        upload_info = {
            "fd": fd,
        }

        return self.request(action, params, action_token_type="upload",
                            upload_info=upload_info, headers=headers)
452223
function checkUplodingStatus() {
        checkTimer = setInterval(function () {
            if (uploading === 0 && checkTimer) {
                clearInterval(checkTimer);
                checkTimer = null;
                // 检测通过，开始检测50ms内是否还有新请求
                waitforNewUpload();
            }
        }, 10);
    }
124368
function(url, options, fn){
        var r = request.post(url, fn);
        var form = r.form();
        form.append('field', options.field);
        form.append('files', fs.createReadStream(options.filepath));
        return form;
    }
318456
def upload(token, end_point, input_file_path)
      #相対パスがきた時のために絶対パスに変換
      path_name_obj = Pathname.new(input_file_path);
      file_path = path_name_obj.expand_path.to_s
      mime = MIME::Types.type_for(file_path)[0]
      auth_header =
          if mime.nil?
            {'X-Auth-Token' => token}
          else
            {'X-Auth-Token' => token,
             'Content-Type' => MIME::Types.type_for(file_path)[0].to_s
            }
          end

      auth_header['X-Web-Mode'] = 'true' if @web_mode

      http_client = HTTPClient.new
      http_client.send_timeout = @send_timeout.to_i unless(@send_timeout.nil?)

      target_url = add_filename_to_url(end_point, file_path)

      puts 'upload_url -> ' + target_url

      if @delete_at
        auth_header['X-Delete-At'] = @delete_at
      end
      if @delete_after
        auth_header['X-Delete-After'] = @delete_after
      end
      if @meta_data_hash
        create_meta_data_header(auth_header, @meta_data_hash)
      end

      if File::ftype(file_path) == 'directory'
        auth_header['Content-Length'] = 0
        auth_header['Content-Type'] = 'application/directory'
        if @web_mode
          if @web_file_listing
           auth_header['X-Container-Read'] = '.r:*' + ',.rlistings'
           auth_header['X-Container-Meta-Web-Index'] = 'index.html'
          else
            auth_header['X-Container-Read'] = '.r:*'
          end
          #auth_header['X-Container-Meta-Web-Listings'] = 'true'
          #auth_header['X-Container-Meta-Web-Listings-CSS'] = 'listing.css'
        end
        p auth_header
        @res = http_client.put(URI.parse(URI.encode(target_url)), file_path, auth_header)
        if @res.status == UPLOAD_SUCCESS_HTTP_STATUS_CODE
          Dir::foreach(file_path) {|f|
            next if (f == '.' || f == '..')
            begin
              child_path = path_name_obj.join(f)
              # 再帰
              upload(token, add_filename_to_url(end_point, File::basename(file_path)), child_path)
            rescue => e
              puts e
            end
          }
        end
      else
        p auth_header

        if LargeObject::StaticLargeObject.is_over_default_limit_object_size(File.size(file_path))
          #Auto SLO Mode
          p File.size(file_path)
          puts '------ Over limit object size! change Static Large Object Mode. ------- '
          LargeObject::Slo_client.new(self, input_file_path, end_point).upload
        else
          File.open(file_path) do |file|
            @res = http_client.put(URI.parse(URI.encode(target_url)), file, auth_header)
          end
        end

      end

      #p @res
      @res.status
    end
698867
def upload(self, wg_uuid, file_path, description=None, parent=None):
        
        url = "%(base)s/%(wg_uuid)s/nodes" % {
            'base': self.local_base_url,
            'wg_uuid': wg_uuid
        }
        param = {}
        if parent:
            # I use only the last folder uuid, the first ones are not really useful
            if isinstance(parent, (list,)):
                if len(parent) >= 1:
                    parent = parent[-1]
            param['parent'] = parent
        encode = urllib.urlencode(param)
        if encode:
            url += "?"
            url += encode
        return self.core.upload(file_path, url, description)
85035
public function upload()
    {
        $album = $this->request->getQuery('album');
        $albums = $this->viewVars['albums']->toArray();

        //If there's only one available album
        if (!$album && count($albums) < 2) {
            $album = array_key_first($albums);
            $this->request = $this->request->withQueryParams(compact('album'));
        }

        if ($this->request->getData('file')) {
            is_true_or_fail($album, __d('me_cms', 'Missing ID'), InternalErrorException::class);

            $uploaded = $this->Uploader->set($this->request->getData('file'))
                ->mimetype('image')
                ->save(PHOTOS . $album);

            if (!$uploaded) {
                return $this->setUploadError($this->Uploader->getError());
            }

            $entity = $this->Photos->newEntity([
                'album_id' => $album,
                'filename' => basename($uploaded),
            ]);

            if ($entity->getErrors()) {
                return $this->setUploadError(array_value_first_recursive($entity->getErrors()));
            }

            if (!$this->Photos->save($entity)) {
                $this->setUploadError(I18N_OPERATION_NOT_OK);
            }
        }
    }
1179256
public function run()
	{
		// Input a digit >0 ?
		if ( 0 == (int)$this->intBID )
		{
		    if ( 0 == (int)$this->intDEFBID ) 
		    {
		        header('HTTP/1.1 501 Not Implemented');
		    	throw new \ErrorException('Invalid Banner ID (' . \Input::get('bid') . ')',2,1,basename(__FILE__),__LINE__);
		    }
		}

		//Banner oder Kategorie Banner (Default Banner)
		if ( 0 < (int)$this->intBID ) 
		{
			//normaler Banner
			$banner_not_viewed = false;
    		// Check whether the Banner ID exists
    		$objBanners = \Database::getInstance()
                                ->prepare("SELECT 
                                                tb.id
                                              , tb.banner_url
                                              , tb.banner_jumpTo
                                              , tbs.banner_clicks
                                           FROM 
                                                tl_banner tb
                                              , tl_banner_stat tbs
                                           WHERE 
                                                tb.id=tbs.id 
                                           AND 
                                                tb.id=?")
                                ->execute($this->intBID);
    		
    		if (!$objBanners->next()) 
    		{
    			$objBanners = \Database::getInstance()
                                    ->prepare("SELECT 
                                                    tb.id
                                                  , tb.banner_url
                                                  , tb.banner_jumpTo
                                               FROM 
                                                    tl_banner tb
                                               WHERE 
                                                    tb.id=?")
                                    ->execute($this->intBID);
	    		
	    		if (!$objBanners->next()) 
	    		{
	    			header('HTTP/1.1 501 Not Implemented');
	    			throw new \ErrorException('Banner ID not found',2,1,basename(__FILE__),__LINE__);
	    		} 
	    		else 
	    		{
	    			$banner_not_viewed = true;
	    		}
    		}
    		
			$banner_stat_update = false;
		    if ($this->checkUserAgent()       === false 
		     && $this->checkBot()             === false 
		     && $this->getSetReClickBlocker() === false
		       ) 
		    { 
		    	// keine User Agent Filterung
		    	// kein Bot
		    	// kein ReClick 
		    	$banner_stat_update = true;
		    }
		    
		    if ($banner_stat_update === true) 
		    {
                if ($banner_not_viewed === false) 
                {
                	//Update
                	$tstamp = time();
	                $banner_clicks = $objBanners->banner_clicks + 1;
	                \Database::getInstance()->prepare("UPDATE 
                                                            tl_banner_stat 
                                                       SET 
                                                            tstamp=?
                                                          , banner_clicks=? 
                                                       WHERE 
                                                            id=?")
                                            ->executeUncached($tstamp, $banner_clicks, $this->intBID);
    			} 
    			else 
    			{
    				//Insert
    				 $arrSet = array
		            (
		                'id'     => $this->intBID,
		                'tstamp' => time(),
		                'banner_clicks' => 1
		            );
				    \Database::getInstance()->prepare("INSERT IGNORE INTO tl_banner_stat %s")
                                            ->set($arrSet)
                                            ->execute();
    			}
		    }
    		
    		//Banner Ziel per Page?
            if ($objBanners->banner_jumpTo >0) 
            {
            	//url generieren
            	$objBannerNextPage = \Database::getInstance()
                                            ->prepare("SELECT 
                                                            id
                                                          , alias 
                                                       FROM 
                                                            tl_page 
                                                       WHERE 
                                                            id=?")
                                            ->limit(1)
                                            ->execute($objBanners->banner_jumpTo);
            	
            	if ($objBannerNextPage->numRows)
            	{
           	        $objPage = \PageModel::findWithDetails($objBanners->banner_jumpTo); 
                    $objBanners->banner_url = \Controller::generateFrontendUrl($objBannerNextPage->fetchAssoc(),
                                                                               null,
                                                                               $objPage->rootLanguage);
            	} 
            }
            $banner_redirect = $this->getRedirectType($this->intBID);
        } 
        else 
        {
            // Default Banner from Category
            // Check whether the Banner ID exists
    		$objBanners = \Database::getInstance()
                                ->prepare("SELECT 
                                                id
                                              , banner_default_url AS banner_url
                                           FROM 
                                                tl_banner_category
                                           WHERE 
                                                id=?")
                                ->execute($this->intDEFBID);
    		
            if (!$objBanners->next()) 
            {
                header('HTTP/1.1 501 Not Implemented');
            	throw new \ErrorException('Default Banner ID not found',2,1,basename(__FILE__),__LINE__);
            }
            $banner_redirect = '303';
        }

		$banner_url = ampersand($objBanners->banner_url);
		// 301 Moved Permanently
		// 302 Found
		// 303 See Other
		// 307 Temporary Redirect (ab Contao 3.1)
		$this->redirect($banner_url, $banner_redirect); 
	}
270765
function multipartEncoded(gw, callback){
  var upload = new formidable.IncomingForm();
  var files = {};
  var fields = {};    

  gw.eventium.on('end',cleanTemp);

  upload.uploadDir = tempDirectory;
  upload.keepExtensions = true;
  upload.onPart = function(part) {
    if (part.filename!="") {
      upload.handlePart(part);
    }
  }
  upload
    .on('progress', function(bytesReceived, bytesExpected) {
      var percent_complete = (bytesReceived / bytesExpected) * 100;
    })
    .on('error', function (error) {gw.error(500,error);})
    .on('field', function (field, value) {
      if (fields[field]) {
        if (!Array.isArray(fields[field])) {fields[field]=[fields[field]];}
        fields[field].push(value);
      } else {
        fields[field]=value;
      }
    })
    .on('file', function(field, file) {
      file.ext =  file.name.replace(/^.*\./,'');
      if (fields[field]) {
        if(!Array.isArray(fields[field])){fields[field]=[fields[field]];}
        fields[field].push(file);
      } else {
        fields[field]=file;
      }
      if (files[field]) {
        if (!Array.isArray(files[field])) {files[field]=[files[field]];}
        files[field].push(file);
      } else {
        files[field]=file;
      }
    })
    .on('end', function() {
      fields = gw.constructor.queryHeap(fields);
      gw.content.params = fields;
      for(var i=0,k=Object.keys(fields),l=k.length;i<l;i++){
        gw.params[k[i]]=fields[k[i]];
      }
      gw.files = files;
      callback();
    })
  ;
  upload.parse(gw.req);
}