optional - Process uploaded file(s) depending on the specified technology. Default value is 'false'
541279
protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        String tech = request.getParameter(PARAMETER_TECH);
        String workspaceId = request.getParameter(PARAMETER_WORKSPACE);    //specify the unique workspace directory to upload the file(s) to.    
        Collection<Part> filePartCollection = request.getParts();
        
        String serverHostPort = request.getRequestURL().toString().replace(request.getRequestURI(), "");
        int schemeLength = request.getScheme().toString().length();
        String internalHostPort = "http" + serverHostPort.substring(schemeLength);
        log.log(Level.FINER, "serverHostPort : " + serverHostPort);
        final ServiceConnector serviceConnector = new ServiceConnector(serverHostPort, internalHostPort);
        HashMap<Part, String> fileNames = new HashMap<Part, String>();
        if(!isValidRequest(request, response, tech, workspaceId, filePartCollection, serviceConnector, fileNames)){
            return;
        }

        Service techService = serviceConnector.getServiceObjectFromId(tech);
        String techDirPath = StarterUtil.getWorkspaceDir(workspaceId) + "/" + techService.getId();
        File techDir = new File(techDirPath);
        if(techDir.exists() && techDir.isDirectory() && "true".equalsIgnoreCase(request.getParameter(PARAMETER_CLEANUP))){
            FileUtils.cleanDirectory(techDir);
            log.log(Level.FINER, "Cleaned up tech workspace directory : " + techDirPath);
        }

        for (Part filePart : filePartCollection){
            if(!techDir.exists()){
                FileUtils.forceMkdir(techDir);
                log.log(Level.FINER, "Created tech directory :" + techDirPath);
            }
            
            String filePath = techDirPath + "/" + fileNames.get(filePart);
            log.log(Level.FINER, "File path : " + filePath);
            File uploadedFile = new File(filePath);

            Files.copy(filePart.getInputStream(), uploadedFile.toPath(), StandardCopyOption.REPLACE_EXISTING);
            log.log(Level.FINE, "Copied file to " + filePath);    
        }

        if("true".equalsIgnoreCase(request.getParameter(PARAMETER_PROCESS))){
            // Process uploaded file(s)
            String processResult = serviceConnector.processUploadedFiles(techService, techDirPath);
            if(!processResult.equalsIgnoreCase("success")){
                log.log(Level.INFO, "Error processing the files uploaded to " + techDirPath + " : Result=" + processResult);
                response.sendError(500, processResult);
                return;
            }
            log.log(Level.FINE, "Processed the files uploaded to " + techDirPath);    
        }

        response.setContentType("text/html");
        PrintWriter out = response.getWriter();
        out.println("success");
        out.close();
    }
197316
def upload_file_handle(
            self,
            bucket: str,
            key: str,
            src_file_handle: typing.BinaryIO,
            content_type: str=None,
            metadata: dict=None):
        
        raise NotImplementedError()
16545
function defaults(opts) {
  opts = opts || {}

  if (!opts.streamer) {
    throw new Error('No streamer found. Must pass a streamer to multipart-pipe')
  }

  opts.limit = opts.limit === undefined ? '128mb' : opts.limit;
  opts.limit = typeof opts.limit === 'string' ? parseBytes(opts.limit) : opts.limit;
  opts.allow = opts.allow instanceof RegExp ? opts.allow : new RegExp(opts.allow || '.*');

  if (!opts.filename || typeof opts.filename !== 'function') {
    opts.filename = function (filename, mime) { return filename; };
  }

  return opts
}
1233585
function processFile(file, filename, callback) {
      // Check if it matches the convention.
      if (path.extname(filename) === '.metadata') {
        // Find the name of the metadata.
        const name = path.basename(filename, '.metadata')

        // Recursively merge the meta data.
        const newMetadata = {}
        newMetadata[name] = file
        extend(true, metadata, newMetadata)

        // Remove the file since we've now processed it.
        delete files[filename]
      }

      callback()
    }
905372
function processFile (file, version, versions, targetVersions) {
  processTags(file.content, version, versions, file)
  processVersioned(file.content, version, versions)
  processVersionLists(file.content, version, targetVersions)
  return file
}
215614
boolean isMultiPartFormData() {
		for(HttpParameter parameter : parameters) {
			if(parameter.getType() == Type.FILE) {
				return true;
			}
		}
		return false;
	}
599004
def _validate_file_format(self, file_format):
        """"""

        if file_format not in self.valid_file_formats:
            raise InvalidFileFormatError(
                "{} is not a valid file format".format(file_format)
            )

        return file_format
571866
def process_formdata(self, valuelist):
        ''''''
        super(EmptyNone, self).process_formdata(valuelist)
        self.data = self.data or None
484538
def handle_unauthorized_file_type(error):
    ''''''
    url = url_for('api.allowed_extensions', _external=True)
    msg = (
        'This file type is not allowed.'
        'The allowed file type list is available at {url}'
    ).format(url=url)
    return {'message': msg}, 400
405014
def _local_upload(self, filepath, remove=False):
        """"""
        if os.path.isfile(filepath):
            filename = os.path.basename(os.path.abspath(filepath))
            if filename and self.__isValidFilename(filename):
                suffix = self.__getFilenameSuffix(filename)
                try:
                    self.__unpack_tgz(os.path.abspath(filepath)) if self.__isValidTGZ(suffix) else self.__unpack_zip(os.path.abspath(filepath))
                finally:
                    if remove is True:
                        os.remove(filepath)
            else:
                raise InstallError("Invalid Filename")
        else:
            raise InstallError("Invalid Filepath")
335473
def hydrate_input_uploads(input_, input_schema, hydrate_values=True):
    
    from resolwe.flow.managers import manager

    files = []
    for field_schema, fields in iterate_fields(input_, input_schema):
        name = field_schema['name']
        value = fields[name]
        if 'type' in field_schema:
            if field_schema['type'] == 'basic:file:':
                files.append(value)

            elif field_schema['type'] == 'list:basic:file:':
                files.extend(value)

    urlregex = re.compile(r'^(https?|ftp)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]')
    for value in files:
        if 'file_temp' in value:
            if isinstance(value['file_temp'], str):
                # If file_temp not url, hydrate path.
                if not urlregex.search(value['file_temp']):
                    value['file_temp'] = manager.get_executor().resolve_upload_path(value['file_temp'])
            else:
                # Something very strange happened.
                value['file_temp'] = 'Invalid value for file_temp in DB'
493526
def process_tags(self, tag=None):
        """"""
        if self.downloaded is False:
            raise serror("Track not downloaded, can't process tags..")
        filetype = magic.from_file(self.filepath, mime=True)
        if filetype != "audio/mpeg":
            raise serror("Cannot process tags for file type %s." % filetype)

        print("Processing tags for %s.." % self.filepath)
        if tag is None:
            tag = stag()
        tag.load_id3(self)
        tag.write_id3(self.filepath)
652735
def process_file(filename):
    """"""
    try:
        with codecs.open(filename, encoding='utf-8', mode='r') as f:
            file_contents = f.read()
    except IOError:
        log.info('Unable to read file: %s', filename)
        return None
    data = json.loads(file_contents)
    title = ''
    body_content = ''
    if 'current_page_name' in data:
        path = data['current_page_name']
    else:
        log.info('Unable to index file due to no name %s', filename)
        return None
    if 'body' in data and data['body']:
        body = PyQuery(data['body'])
        body_content = body.text().replace(u'¶', '')
    else:
        log.info('Unable to index content for: %s', filename)
    if 'title' in data:
        title = data['title']
        if title.startswith('<'):
            title = PyQuery(data['title']).text()
    else:
        log.info('Unable to index title for: %s', filename)

    return {'headers': process_headers(data, filename),
            'content': body_content, 'path': path, 'title': title}
1126590
def process_files
      if @options[:parallel].empty?
        files.map { |path| check_path(path) }
      else
        Parallel.map(files, @options[:parallel]) { |path| check_path(path) }
      end
    end
187110
public function process ()
		{
			if (!empty( $this->_params ))
			{
				if ($this->getIsUploading())
					$this->uploadChunk();
				else
					$this->testChunk();
			}
		}
1052507
def file_type(self, value):
        
        if isinstance(value, FileType):
            self._file_type = value
        else:
            self._file_type = FileType(value)
149607
function (options, callback) {

			fs.stat(options.file_path, function (err, stats) {

				if (err) {
					callback(err);
				}
				else {
					var local_date = new Date(stats.mtime).getTime();
					var server_date = new Date(options.server_date).getTime();

					if (options.compare_date === 'newer') {
						callback(null, local_date > server_date);
					}
					else {
						callback(null, local_date < server_date);
					}
				}
			});
		}