luis901101 / cloudflare Goto Github PK
View Code? Open in Web Editor NEWLicense: BSD 2-Clause "Simplified" License
License: BSD 2-Clause "Simplified" License
Hi,
Currently, when using contentFromBytes when uploading an image, all image file names on CloudFlare appear as 'image-from-bytes'
//From bytes
CloudflareHTTPResponse<CloudflareImage?> responseFromBytes = await cloudflare.imageAPI.upload(
contentFromBytes: DataTransmit<Uint8List>(data: imageBytes, progressCallback: (count, total) {
print('Upload progress: $count/$total');
})
);
this seems to be because the HTTP post is specifying it as such. Please can the file name be abstracted so that we can specify it in imageAPI.upload() call?
@POST('/v1')
@MultiPart()
@Headers(RestAPIService.defaultHeaders)
Future<HttpResponse<CloudflareResponse?>> uploadFromBytes({
@Part(name: Params.file, fileName: 'image-from-bytes')
required List<int> bytes,
@Part() bool? requireSignedURLs,
@Part() Map<String, dynamic>? metadata,
@SendProgress() ProgressCallback? onUploadProgress,
@CancelRequest() CancelToken? cancelToken,
});
The connection errored: The XMLHttpRequest onError callback was called. This typically indicates an error on the network layer. This indicates an error which most likely cannot be solved by the library
I'm using the API from a flutter app (iOS and Android). Based on the docs, being a client-app, I instantiate Cloudflare using the basic constructor:
Future<void> savePhoto(File img) async {
final cloudflare = Cloudflare.basic();
await cloudflare.init();
final response = await cloudflare.imageAPI.createDirectUpload();
final dataUploadDraft = response.body;
try {
await cloudflare.imageAPI.directUpload(
dataUploadDraft: dataUploadDraft!,
contentFromFile: DataTransmit<File>(
data: img,
progressCallback: (count, total) {
print(
'Image upload to direct upload URL from file: $count/$total');
}));
} catch (e) {
print(e);
}}
On execution, I receive the following:
package: 'cloudflare/src/apiservice/image_api.dart': Failed assertion: line 429 pos 12: '!isBasic': Thsi endpoing requires an authorized request, check the Cloudflare constructure you are using and make sure you are using a valid 'accountId' and 'token'.
When I switch the non-basic constructor, it works perfectly:
final cloudflare = Cloudflare(
accountId: "my_account_id",
token: "my_token",
);
I'm using cloudflare: ^3.1.0+16
Any plans to support R2 ?
Hi!
Thanks for an awesome package.
When I'm using the TUS protocol I get the following error:
Unhandled Exception: PathNotFoundException: Cannot open file,
The upload starts, but then throws this error about half way through.
Error:-
Launching lib\main.dart on DN2101 in debug mode...
lib\main.dart:1
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/cloudflare-1.3.0+11/lib/src/apiservice/stream_api.dart:832:36: Error: The getter 'name' isn't defined for the class 'MediaProcessingState'.
'MediaProcessingState' is from 'package:cloudflare/src/enumerators/media_processing_state.dart' ('/C:/flutter/.pub-cache/hosted/pub.dartlang.org/cloudflare-1.3.0+11/lib/src/enumerators/media_processing_state.dart').
package:cloudflare/…/enumerators/media_processing_state.dart:1
Try correcting the name to the name of an existing getter, or defining a getter or field named 'name'.
status: status?.map((e) => e.name).join(','),
^^^^
/C:/flutter/.pub-cache/hosted/pub.dartlang.org/cloudflare-1.3.0+11/lib/src/entity/cloudflare_stream_video.dart:328:44: Error: The getter 'name' isn't defined for the class 'ThumbnailFit'.
Flutter Version :- 2.5.3
Code Editor VSCode
please help me out ASAP, Thanks...
Thank you for creating such an incredible repository,
"Direct Creator Upload with Custom ID"
https://developers.cloudflare.com/images/cloudflare-images/upload-images/direct-creator-upload/
Please, Add this functionality in cloudflare.imageAPI.createDirectUpload or a new function.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.