We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
posting a binary file doing:
response := ZnClient new ifFail:[ :ex | self dataLoadFailed: ex ]; headerAt:'x-api-key' put: self apiKey; addPart: (ZnMimePart fieldName: #file fileNamed: aFileName ); url: self url, self apiUrlFileUpload; post; response.
Fails, giving message #binary not understood. Solved doing ....
mimeType isBinary ifTrue: [ fileStream := fileStream wrappedStream ].
....
fieldName: fieldName fileNamed: fileName | mimeType size fileStream entity baseName | mimeType := ZnMimeType forFilenameExtension: (ZnFileSystemUtils extensionFor: fileName). fileStream := ZnFileSystemUtils oldFileStreamFor: fileName. mimeType isBinary ifTrue: [ fileStream binary ]. size := ZnFileSystemUtils fileSizeFor: fileName. (entity := ZnStreamingEntity type: mimeType length: size) stream: fileStream. baseName := ZnFileSystemUtils baseNameFor: fileName. ^ self fieldName: fieldName fileName: baseName entity: entity
The text was updated successfully, but these errors were encountered:
Sorry it is an older versión
Sorry, something went wrong.
No branches or pull requests
posting a binary file doing:
response := ZnClient new
ifFail:[ :ex | self dataLoadFailed: ex ];
headerAt:'x-api-key' put: self apiKey;
addPart: (ZnMimePart fieldName: #file fileNamed: aFileName );
url: self url, self apiUrlFileUpload;
post;
response.
Fails, giving message #binary not understood. Solved doing
....
mimeType isBinary ifTrue: [ fileStream := fileStream wrappedStream ].
....
fieldName: fieldName fileNamed: fileName
| mimeType size fileStream entity baseName |
mimeType := ZnMimeType forFilenameExtension: (ZnFileSystemUtils extensionFor: fileName).
fileStream := ZnFileSystemUtils oldFileStreamFor: fileName.
mimeType isBinary ifTrue: [ fileStream binary ].
size := ZnFileSystemUtils fileSizeFor: fileName.
(entity := ZnStreamingEntity type: mimeType length: size)
stream: fileStream.
baseName := ZnFileSystemUtils baseNameFor: fileName.
^ self fieldName: fieldName fileName: baseName entity: entity
The text was updated successfully, but these errors were encountered: