ivanvermeyen / laravel-google-drive-demo

Laravel & Google Drive Storage - Demo project with Laravel 5.4
405 stars 155 forks source link

How to upload a file directly from a form #61

Closed felix2056 closed 5 years ago

felix2056 commented 5 years ago

Does the file I want to upload necessarily have to be in my storage path? Can't I upload directly from a form to google drive? I just started using Laravel last week so am new to it's file uploading methods and all. The put route example you have on your route file creates a txt file and uploads. And the put-existing tries to locate the file in my public path then uploads to drive. But can I have something that just uploads directly to drive? sorry if this is a rookie question coming from an inexperienced guy.

ivanvermeyen commented 5 years ago

Hello,

You should be able to upload directly to your google disk: https://laravel.com/docs/5.8/requests#storing-uploaded-files

sergiblue4 commented 5 years ago

Ok that worked for me thanks for your help

ivanvermeyen commented 5 years ago

np, glad it helped :)

moinologics commented 4 years ago

hi @ivanvermeyen, the solution u give above works correctly on native HTML forms. but file upload progress using javascript ajax, XHR not giving progress as the file uploaded. instead, xhr gives 100% in one time but the file is being uploaded. actually my problem is to upload the file on google drive and track the progress of the upload. and my server didn't have much RAM/execution-time/storage access. so please suggest me some good idea to achieve my goal.

ivanvermeyen commented 4 years ago

@ProgrammingPlanet I'm not an expert on this, but perhaps this can be of use to you? https://www.sitepoint.com/tracking-upload-progress-with-php-and-javascript/

Also, an example to put and get files using streams was added earlier: see this commit. This is also useful to minimize the server memory needed.