Pick Files and Upload to Google Drive

this is the aia file for it

antarees(1).aia (448.4 KB)

this one is for file upload via php and below is the php script

<?php

set_time_limit(0);

$cv= $_POST['cv'];
$cvext = $_POST['cvext'];

#$cvdata = $cv;

$cvdata = base64_decode(str_replace(array('-', '_',' ','\n'), array('+', '/','+',' '), $cv));

$cvfile = fopen("test/".$cvext, "wb") or die("Unable to open file!");

fwrite($cvfile, $cvdata);
fclose($cvfile);

 $cvpath = fopen("test/cvfile.txt", "w") or die("Unable to open file!");
 
fwrite($cvpath, 'test/'.$cvext);

fclose($cvpath);


echo $cvext;

?>

Actually that's what annoyed me and I lost more than 5 days on it and that's the reason why I want it be fixed for money and hassle free.

Please try the two examples again from the beginning, without any modifications, once we have those working you can add the things you want, and keep testing as you do that.

Remember, with a web app:

1 Open the script project
2 Go to Publish
3 Deploy as Web App
4 Project version: - select New from the dropdown
5 Execute the app as: your google account address (email)
6 Who has access to the app: Anyone, even anonymous
7 Press the Update button

You have to do this EVERY TIME you change your script

2 Likes

I tried them regarding the GDrive it uploads only images but the problem isn't the images it's the file picker which is most important

did u try it and got it work so far till now or not , with all these android api versions updates ???

You can confirm that you are able to use the Upload to Google Drive demo to upload the image file provided ?

The issue now is picking a different file for upload ? Yes there are a few problems arising following the latest update, especially for Android 10+ devices, due to Google's tightening of file access policies. There is a bugfix release due soon, it is in testing at the moment. there are several topics on the forum about getting the correct file path, I have not seen a definitive solution yet for all situations, all android versions, but i am sure this will be forthcoming shortly. What is you android version of your device? We can then seek a solution from there....

Have you tried the php post file solution on your server yet ?

I can confirm it upload only image files but any other extension not at all that's why I'm posting this and I need help in it.

the point is did you test it on your side and it worked with you or not to upload any file extension if so then please share otherwise we need to wait for a solution of this unsolved problem

The demo app is setup to handle any file type (those i have tested I know work). The script will work with any file type.

I have just retested the demo app with a txt and a zip file, these worked OK.

What are you trying to upload, how big is it (hopefully less than 5mb) and what are you changing in the app ?

1 Like

I don't think it will exceed more than 5 mb but maybe there are some files will be more , can you share the aia file please ?

It is the same one as you will have downloaded from my web page ? (linked above)

All I did was add new files to the assets and change the name of the file to be uploaded

oh I don't mean in the assets , I mean as file picker or stored in the phone where I can choose a file already.

Doesn't matter where the file is. It is just a demo app, so I only changed the bare minimum to test.
You asked if it could upload files other than images, which it can.

regarding the embedded assets already inside the project sure it can , but that's not my point at all I mean when I pick another file such as from the SD card or from the phone memory not embedded
[ file:// ]

That is a different issue. You will need to check that the file path returned for the file that you pick meets the requirements of the blocks for the uploading section. You may get a content uri which needs converting, or if on Android 10 a "wrong" file path that needs correcting, or you may need to extract the filename from the file path returned. Use Do It on your blocks once you have picked a file to see what you are getting back.

Remember, in the demo the files are in the assets - there is no file path - per se... (<Android 10)

I wasted more than 6 days so far on this that's why I said enough of it and pay to let someone else do it for me , because I can't keep suffering in anything in my life like this.

It is not too difficult. I have my hands full on something else at the moment, but will look at adding a file picker method to the upload demo.

1 Like

@Don_Ammar

I have prepared a demo app, based upon the previous one, that includes a file picker. This has been tested with companion on my Genymotion Emulator, using Android 9 and 10 - it works fine on both android versions.

Let me know how you get on with it.

Gratitudes: :clap: to @Taifun for the File Extension and @Juan_Antonio for the Base64 Extension, without whom, and their good work, none of this would be possible :smiley:

AIA File
UAFTGD_FilePicker.aia (103.5 KB)

(you will need to add the url to your google apps script)

5 Likes

Thank you so much I will test it :heart::heart::heart:

that helped me sOOoooooOOoooo much

Yap sure Special thanks to [Taifun] for making plenty of awesome extensions which I use most of them actually.

thanks to [Juan] he made great extension for base64

and super thanks for you because you solved the most hard weird problem [ file uploading ] ever :heart:

2 Likes

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.