Assigns new data from an uploaded file. In addition to the actions
 performed by <tt>data=</tt>, this will set <tt>content_type</tt> and
 <tt>filename</tt>.
492578
def file=(file)
      self.data = file
      dis_set :content_type, file.content_type
      dis_set :filename, file.original_filename
    end
1143318
public static void setFileProperties (final File file, final String contentType) throws IOException, FrameworkException {

		final java.io.File fileOnDisk = file.getFileOnDisk(false);
		final PropertyMap map         = new PropertyMap();

		map.put(StructrApp.key(File.class, "contentType"), contentType != null ? contentType : FileHelper.getContentMimeType(fileOnDisk, file.getProperty(File.name)));
		map.put(StructrApp.key(File.class, "size"),        FileHelper.getSize(fileOnDisk));
		map.put(StructrApp.key(File.class, "version"),     1);

		map.putAll(getChecksums(file, fileOnDisk));

		file.setProperties(file.getSecurityContext(), map);
	}
191177
void add(final File file) {
    if (file.isFile()) {
      if (this.fileNames.contains(file.getName())) {
        LOG.log(Level.FINEST, "A file with this name has already been added: {0}", file.getName());
      } else {
        this.fileNames.add(file.getName());
        this.theFiles.add(file);
      }
    } else {
      LOG.log(Level.FINEST, "Ignoring, because it is not a proper file: {0}", file);
    }
  }
82750
def add(self, filetype, **kwargs):
        

        location = self.location(filetype, **kwargs)
        source = self.url(filetype, sasdir='sas' if not self.public else '', **kwargs)
        if 'full' not in kwargs:
            destination = self.full(filetype, **kwargs)
        else:
            destination = kwargs.get('full')

        if location and source and destination:
            self.initial_stream.append_task(location=location, source=source, destination=destination)
        else:
            print("There is no file with filetype=%r to access in the tree module loaded" % filetype)
735921
private void putFile(String name, UploadFile uploadFile) {
		UploadFile[] fileUploads = requestFiles.get(name);
		fileUploads = fileUploads == null ? new UploadFile[] { uploadFile } : ArrayUtil.append(fileUploads, uploadFile);
		requestFiles.put(name, fileUploads);
	}
1098241
public function setFile(UploadedFile $file = null)
    {
        $this->file = $file;
        $this->name = $file->getClientOriginalName();
        // check if we have an old image path
        if (isset($this->path)) {
            // store the old name to delete after the update
            $this->temp = $this->path;
            $this->path = null;
        } else {
            $this->path = 'initial';
        }
    }
1141078
void setDataType(Session session, Type type) {

        if (opType == OpTypes.VALUE) {
            valueData = type.convertToType(session, valueData, dataType);
        }

        dataType = type;
    }
806544
private static void setContentTypeHeader(HttpResponse response, File file) {
        MimetypesFileTypeMap mimeTypesMap = new MimetypesFileTypeMap();
        response.headers().set(HttpHeaderNames.CONTENT_TYPE, mimeTypesMap.getContentType(file.getPath()));
    }
919837
def set_with_filename(path)
      return if path.blank?
      
      self.filename = ::File.basename(path)
      self.content_type = ::MIME::Types.type_for(path).first.content_type
      self.data = ::Base64.encode64(::File.read(path))
    end
92736
@Override
    public void setContent(final InputStream content, final String contentType,
                           final Collection<URI> checksums, final String originalFileName,
                           final StoragePolicyDecisionPoint storagePolicyDecisionPoint)
            throws UnsupportedOperationException {
        throw new UnsupportedOperationException(
                "Cannot call setContent() on local file, call setExternalContent() instead");
    }
779666
public void setFile(File file) throws FileNotFoundException{
		this.setInputStream(new BufferedInputStream(new FileInputStream(file)), file.length());
		this.isUploadFile = true;
	}
103804
public void addFilePart(String fieldName, File uploadFile) throws FileNotFoundException {
        stream.put(fieldName, new NamedInputStream(uploadFile.getName(), new FileInputStream(uploadFile), "binary", URLConnection.guessContentTypeFromName(uploadFile.getName())));
    }
431541
def _set_data(self, action):
        
        if 'query' in action:
            self._set_query_data(action)
        elif action == 'imageinfo':
            self._set_imageinfo_data()
        elif action == 'parse':
            self._set_parse_data()
        elif action == 'random':
            self._set_random_data()
        elif action == 'labels':
            self._set_labels()
        elif action == 'wikidata':
            self._set_wikidata()
            self.get_labels()
        elif action == 'restbase':
            self._set_restbase_data()

        self._update_imageinfo()
        self._update_params()
939187
function addFilesToData(IOD, IODOpts, apiType, form) {
	_.each(T.maybeToArray(IODOpts.files), function(file) {
		if (apiType === IOD.TYPES.JOB) {
			form.append(file.name, fs.createReadStream(file.path))
		}
		else form.append('file', fs.createReadStream(file))
	})
}
443925
public void set(byte[] newData, int offset, int length) {
    setSize(0);
    setSize(length);
    System.arraycopy(newData, offset, bytes, 0, size);
  }
710679
protected function setTitleEditFile()
    {
        if (isset($this->data_file['file_id'])) {
            $title = $this->text('Edit %name', array('%name' => $this->data_file['title']));
        } else {
            $title = $this->text('Add file');
        }

        $this->setTitle($title);
    }
594020
private void createDataFile() throws IOException {
        // temporary data file for storage of stream data
        Path path = Paths.get(filePath + ".ser");
        if (Files.deleteIfExists(path)) {
            log.debug("Previous flv data file existed and was removed");
        }
        this.dataChannel = Files.newByteChannel(path, StandardOpenOption.CREATE_NEW, StandardOpenOption.WRITE, StandardOpenOption.READ);
    }