All Projects â†’ CrossGeeks â†’ Fileuploaderplugin

CrossGeeks / Fileuploaderplugin

Licence: mit
Simple cross platform plugin to upload files.

Projects that are alternatives of or similar to Fileuploaderplugin

Pomf
Simple file uploading and sharing
Stars: ✭ 535 (+806.78%)
Mutual labels:  upload, file
Angular Filepond
🔌 A handy FilePond adapter component for Angular
Stars: ✭ 59 (+0%)
Mutual labels:  upload, file
Cj Upload
Higher order React components for file uploading (with progress) react file upload
Stars: ✭ 589 (+898.31%)
Mutual labels:  upload, file
Firebasepushnotificationplugin
Firebase Push Notification Plugin for Xamarin iOS and Android
Stars: ✭ 307 (+420.34%)
Mutual labels:  plugin, xamarin
React Filepond
🔌 A handy FilePond adapter component for React
Stars: ✭ 1,024 (+1635.59%)
Mutual labels:  upload, file
File Upload With Preview
🖼 A simple file-upload utility that shows a preview of the uploaded image. Written in pure JavaScript. No dependencies. Works well with Bootstrap 4 or without a framework.
Stars: ✭ 352 (+496.61%)
Mutual labels:  upload, file
Aetherupload Laravel
A Laravel package to upload large files 上传大文件的Laravel扩展包
Stars: ✭ 835 (+1315.25%)
Mutual labels:  upload, file
ic-firebase-uploader
This component is a multi-file uploader for firebase
Stars: ✭ 21 (-64.41%)
Mutual labels:  upload, file
Resumable.php
PHP backend for resumable.js
Stars: ✭ 32 (-45.76%)
Mutual labels:  upload, file
Metrica Plugin Xamarin
Xamarin plugin for Yandex AppMetrica SDK
Stars: ✭ 12 (-79.66%)
Mutual labels:  plugin, xamarin
ShareX-CDN
Basic image, text & file uploader CDN for ShareX
Stars: ✭ 22 (-62.71%)
Mutual labels:  upload, file
Droply Js
Droply JS, a new responsive and cross browser chunk uploader with DragDrop and File Preview capabilities (HTML5/CSS3)
Stars: ✭ 50 (-15.25%)
Mutual labels:  upload, file
safe-svg
Enable SVG uploads and sanitize them to stop XML/SVG vulnerabilities in your WordPress website.
Stars: ✭ 129 (+118.64%)
Mutual labels:  upload, file
Sonatamediabundle
Symfony SonataMediaBundle
Stars: ✭ 415 (+603.39%)
Mutual labels:  upload, file
file-upload-with-preview
🖼 Simple file-upload utility that shows a preview of the uploaded image. Written in TypeScript. No dependencies. Works well with or without a framework.
Stars: ✭ 406 (+588.14%)
Mutual labels:  upload, file
Chibisafe
Blazing fast file uploader and awesome bunker written in node! 🚀
Stars: ✭ 657 (+1013.56%)
Mutual labels:  upload, file
mat-file-upload
A simple & configurable Angular Material file upload component.
Stars: ✭ 14 (-76.27%)
Mutual labels:  upload, file
react-file-input-previews-base64
This package provides an easy to use, ready to go and customizable wrapper around file input, with option for image previews and returning file as base64 string.
Stars: ✭ 15 (-74.58%)
Mutual labels:  upload, file
Fileup
FileUp - JQuery File Upload
Stars: ✭ 10 (-83.05%)
Mutual labels:  upload, file
Uploader
A lightweight and very configurable jQuery plugin for file uploading using ajax(a sync); includes support for queues, progress tracking and drag and drop.
Stars: ✭ 1,042 (+1666.1%)
Mutual labels:  upload, file

FileUploader Plugin for Xamarin iOS, Android, UWP, Mac, tvOS and watchOS

Simple cross platform plugin for file multipart uploads.

     

Features

  • Multipart file uploading with headers and parameters
  • Upload multiple files at once
  • Upload request progress feedback
  • Upload files by using bytes or file path
  • Set custom boundary

Setup

Platform Support

Platform Version
Xamarin.iOS iOS 7+
Xamarin.Android API 15+
Windows 10 UWP 10+
Xamarin.Mac 10.9+
watchOS 2.0+
tvOS 9.0+

API Usage

Call CrossFileUploader.Current from any project or PCL to gain access to APIs.

You can upload a file using the file path or bytes.

FilePathItem

/// <summary>
/// Path: File path location.
/// FieldName: Request field name for the file to be uploaded
/// </summary>
public class FilePathItem
{
    public string Path { get; } 
    public string FieldName {get; } 
}

FileBytesItem

/// <summary>
/// FieldName: Request field name for the file to be uploaded
/// Bytes: File bytes.
/// Name: Name of the file.
/// </summary>
public class FileBytesItem
{
    public string Name { get; }
    public string FieldName { get; }
    public byte[] Bytes { get; }
}

UploadFileAsync

        /// <summary>
        /// Upload file using file path
        /// </summary>
        /// <param name="url">Url for file uploading</param>
        /// <param name="fileItem">File path item to be uploaded</param>
        /// <param name="headers">Request headers</param>
        /// <param name="parameters">Additional parameters for upload request</param>
        /// <param name="boundary">Custom part boundary</param>
        /// <returns>FileUploadResponse</returns>
        Task<FileUploadResponse> UploadFileAsync(string url, FilePathItem fileItem, IDictionary<string,string> headers =null,IDictionary < string, string> parameters = null, string boundary = null);

        /// <summary>
        /// Upload files using file path
        /// </summary>
        /// <param name="url">Url for file uploading</param>
        /// <param name="fileItems">File path items to be uploaded</param>
        /// <param name="tag">Tag reference of the upload request</param>
        /// <param name="headers">Request headers</param>
        /// <param name="parameters">Additional parameters for upload request</param>
        /// <param name="boundary">Custom part boundary</param>
        /// <returns>FileUploadResponse</returns>
        Task<FileUploadResponse> UploadFileAsync(string url, FilePathItem[] fileItems,string tag, IDictionary<string, string> headers = null, IDictionary<string, string> parameters = null, string boundary = null);

        /// <summary>
        /// Upload file using file bytes
        /// </summary>
        /// <param name="url">Url for file uploading</param>
        /// <param name="fileItem">File bytes item to be uploaded</param>
        /// <param name="headers">Request headers</param>
        /// <param name="parameters">Additional parameters for upload request</param>
        /// <param name="boundary">Custom part boundary</param>
        /// <returns>FileUploadResponse</returns>
        Task<FileUploadResponse> UploadFileAsync(string url, FileBytesItem fileItem, IDictionary<string, string> headers = null, IDictionary<string, string> parameters = null, string boundary = null);


        /// <summary>
        /// Upload files using file bytes
        /// </summary>
        /// <param name="url">Url for file uploading</param>
        /// <param name="fileItems">File bytes of items to be uploaded</param>
        /// <param name="tag">Tag reference of upload request</param>
        /// <param name="headers">Request headers</param>
        /// <param name="parameters">Additional parameters for upload request</param>
        /// <param name="boundary">Custom part boundary</param>
        /// <returns>FileUploadResponse</returns>
        Task<FileUploadResponse> UploadFileAsync(string url, FileBytesItem[] fileItems,string tag, IDictionary<string, string> headers = null, IDictionary<string, string> parameters = null,string boundary = null);

Usage sample:

Uploading from a file path

    CrossFileUploader.Current.UploadFileAsync("<URL HERE>", new FilePathItem("<REQUEST FIELD NAME HERE>","<FILE PATH HERE>"), new Dictionary<string, string>()
                {
                   {"<HEADER KEY HERE>" , "<HEADER VALUE HERE>"}
                }
    );

Uploading from a file bytes

  CrossFileUploader.Current.UploadFileAsync("<URL HERE>", new FileBytesItem("<REQUEST FIELD NAME HERE>","<FILE BYTES HERE>","<FILE NAME HERE>"), new Dictionary<string, string>()
                {
                   {"<HEADER KEY HERE>" , "<HEADER VALUE HERE>"}
                }
  );

Uploading multiple files at once

 CrossFileUploader.Current.UploadFileAsync("<URL HERE>", new FilePathItem[]{
    new FilePathItem("file",path1),
	new FilePathItem("file",path2),
	new FilePathItem("file",path3)
 },"Upload Tag 1");

Events in FileUploader

When any file upload completed/failed you can register for an event to fire:

/// <summary>
/// Event handler when file is upload completes succesfully
/// </summary>
event EventHandler<FileUploadResponse> FileUploadCompleted; 
/// <summary>
/// Event handler when file is upload fails
/// </summary>
event EventHandler<FileUploadResponse> FileUploadError; 
 /// <summary>
 /// Event handler when file upload is in progress, indicates what's the upload progress so far
 /// </summary>
 event EventHandler<FileUploadProgress> FileUploadProgress;

For events FileUploadCompleted and FileUploadError you will get a FileUploadResponse with the status and response message:

public class FileUploadResponse
{
        public string Tag { get; }
        public string Message { get; }
        public int StatusCode { get; }
        public IReadOnlyDictionary<string, string> Headers { get; }
}

Usage sample:

  CrossFileUploader.Current.FileUploadCompleted += (sender, response) =>
  {
    System.Diagnostics.Debug.WriteLine($"{response.StatusCode} - {response.Message}");
  };
  
  CrossFileUploader.Current.UploadFileAsync($"<UPLOAD URL HERE>",new FileItem("<FIELD NAME HERE>","<FILE PATH HERE>"));

While upload is in progress you can get feedback on event FileUploadProgress

You will get a FileUploadProgress with the total bytes sent, total request byte length and progress percentage

public class FileUploadProgress
{
        public long TotalBytesSent { get; }
        public long TotalLength { get; }
        public double Percentage { get; }
	public string Tag { get; }

}

Usage sample:

  CrossFileUploader.Current.FileUploadProgress += (sender, uploadProgress) =>
  {
      System.Diagnostics.Debug.WriteLine($"{uploadProgress.Tag} - {uploadProgress.TotalBytesSent} - {uploadProgress.Percentage}");
  };

IMPORTANT

iOS:

On AppDelegate.cs

    /**
     * Save the completion-handler we get when the app opens from the background.
     * This method informs iOS that the app has finished all internal processing and can sleep again.
     */
    public override void HandleEventsForBackgroundUrl(UIApplication application, string sessionIdentifier, Action completionHandler)
    {
        FileUploadManager.UrlSessionCompletion = completionHandler;
    }

Also consider on iOS 9+, your URL must be secured or you have to add the domain to the list of exceptions. See https://github.com/codepath/ios_guides/wiki/App-Transport-Security

Android:

There are some android specific static properties to specify timeout information:

        public static TimeUnit UploadTimeoutUnit { get; set; } = TimeUnit.Minutes;
        public static long SocketUploadTimeout { get; set; } = 5;
        public static long ConnectUploadTimeout { get; set; } = 5;

Above you can see the default values. But you can change the value for the timeouts and unit by setting it from your Android project(Could be on MainActivity) like this:

        FileUploadManager.UploadTimeoutUnit = TimeUnit.Minutes;
        FileUploadManager.SocketUploadTimeout = 10;
        FileUploadManager.ConnectUploadTimeout  = 5;

Contributors

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].