khaledgomaa / Upload-Delete-file-to-from-Google-drive-in-Asp-net

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Upload-Delete-file-to-from-Google-drive-in-Asp-net

Welcome to this simple api

prerequisites :

Explain :-

  1. googledrive.cs :- which contains a three functions :
  • GetService() : responsible to establish the connection to google drive api , required before any operation upload , delete and so on to google drive api , some changes you should to do your own : var path = HttpContext.Current.Server.MapPath("/credentials.json"); line code in GetService() "/credentials.json" this file which you need to download after creating your project on google cloud platform then all you have to do just import the file to your project

-FileUpload() :- takes your image path on your pc then upload to google drive and return the id of the uploaded image which you can later delete or view the image using this id

DeleteFile() :- takes id of the image required to be deleted which already saved from the above step

  1. ProductsController.cs :- just contains two functions
  • addproduct() : which takes filepath and send to googledrive.FileUpload()

-deleteProduct() : takes the fileId and delete it from google drive

About


Languages

Language:C# 100.0%