<?php
// Simple PHP script to save image file.
$imgDir = "ufo1.byethost14.com/";
$fileName = $_REQUEST['fname'];
$data = file_get_contents('php://input');
$store = file_put_contents($imgDir.$fileName, $data);
if ($store !== false ) {
echo "File $fileName saved to server, $store bytes\n";
} else {
echo "File $fileName not saved\n";
}
?>
<?php
// Simple PHP script to save image file.
$imgDir = "ufo1.byethost14.com/";
$fileName = $_REQUEST['fname'];
$data = file_get_contents('php://input');
$store = file_put_contents($imgDir.$fileName, $data);
if ($store !== false ) {
echo "File $fileName saved to server, $store bytes\n";
} else {
echo "File $fileName not saved\n";
}
?>
Also if you want to download a file and trigger the GotFile event you have to set property SaveResponse to true
From the documentation
.Connectivity
SaveResponse
Specifies whether the response should be saved in a file.
Taifun
Talking about rhe upload: here it does not make sense to use the GotFile event, you do not download a file, you like to receive a success message after the upload was successful... therefore use event GotText instead
.
Taifun
As a general advice: do the tutorials to learn the basics!
A very good way to learn App Inventor is to read the free Inventor's Manual here in the AI2 free online eBook App Inventor 2 Book: Create Your Own Android Apps ... the links are at the bottom of the Web page. The book 'teaches' users how to program with AI2 blocks.
There is a free programming course here Course In A Box and the aia files for the projects in the book are here: App Inventor 2 Book: Create Your Own Android Apps
How to do a lot of basic things with App Inventor are described here: How do you...? .
Also do the tutorials Our Tutorials! to learn the basics of App Inventor, then try something and follow the Top 5 Tips: How to learn App Inventor
Taifun
Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.
Paths are case sensitive
There is no such path called /download, it is called /Download
Also what kind of files do you want to upload? Media files or non media files?
See again Some basics on Android storage system
For non media files you need SAF as already mentioned earler
What about showing us a Do it result of your complete path?
Use the companion app and Do it to debug your blocks, see also tip 4 here App Inventor: How to Learn | Pura Vida Apps
see also Live Development, Testing, and Debugging Tools
Taifun
Trying to push the limits! Snippets, Tutorials and Extensions from Pura Vida Apps by Taifun.
@Taifun @TIMAI2 I don't know how to thank you for your patience and help. Unfortunately, I'm already not very good at English, and while I'm doing one thing, I think of three or four other things, and then I lose track of the plot and forget to make some changes (maybe while I'm starting another project). Okay, I'll try to focus on one thing at a time. I know it's called /Download, but when I write, I don't look at what I'm writing.
The files I'm trying to transfer are simple text files (for now). This is just a test project to test the transfers, and anyway, thanks to you, sooner or later I'll get to understand how they work.
Thanks again
@taifun @tima12 io non so come ringraziarti per la pazienza e l'aiuto che mi dai. purtroppo già con l inglese non me la cavo benissimo, inoltre mentre faccio una cosa ne penso altre tre o quattro e poi perdo il filo della trama e scordo di fare alcune modifiche (mentre magari inizio un altro progetto) ok, cercherò di concentrarmi su una cosa per volta, lo so che si chiama /Download e' che quando scrivo non sto li a guardare cosa scrivo
i files che sto cercando di trasferire sono semplici file di testo (per ora) , questo e' solo un progetto di prova per testare i trasferimenti, e comunque grazie a voi prima o poi ariverò anche a capire bene come funzionano
grazie di nuovo
This probably doesn't help. Why not follow the guide and just create a directory called images
.
$imgDir = "images/";
And do the same with your blocks, follow the guide, do not introduce anything new, and show all your text blocks in full.
If you follow the guide exactly then we can more easily compare results.
@TIMAI2 @Taifun I could keep testing for ages, but I'm finding this everywhere, and if the problem is reading and writing...
In Android 14, the READ_EXTERNAL_STORAGE and WRITE_EXTERNAL_STORAGE permissions have been deprecated and are no longer effective for apps targeting API 33 (Android 13) or later. Changes to the permissions system were introduced to increase security and privacy by limiting indiscriminate access to external storage. It's not possible to request generic access to all storage.
What's new in storage permissions in Android 14
The main changes concern the granularity of permissions for accessing media files:
READ_MEDIA_IMAGES: To access images.
READ_MEDIA_VIDEO: To access videos.
READ_MEDIA_AUDIO: To access audio files.
A new permission called READ_MEDIA_VISUAL_USER_SELECTED has been introduced for apps targeting Android 14 (API 34). This permission allows users to grant partial access to selected images and videos, instead of granting full access to the media library.
For testing you should use the ASD or assets, your app will have read/write access to the ASD and read access to assets (media folder).
We can worry about shared storage later, although this is very well covered on the community, and @Taifun has already supplied you with a link to @Anke's Storage topic.
Stop trying to do "everything at once" and focus on one task at a time.
See also here:
allfilespermissions.aix HTML code error 422
allfilespermissions2.aix upload error
pura vida search bar ctrl F not working
I'm solving all my storage permission problems.
which browser are you using?
that's a feature of your browser to search something on a website...
Ctrl-F works for Google Chrome and Firefox
How to Search the Extensions Directory
Please use the Search feature of your browser to search the extensions directory. Use the keyboard shortcut by pressing Ctrl-F. A find bar will appear. Type a search into the find field. See also the Firefox help or Google Chrome help.
Taifun
See the App Inventor Extensions document about how to use an App Inventor Extension
if you get errors, it would help very much to provide also the error text and not only the error number... also a screenshot could help so others can see what you are trying to do
Taifun
I use Chrome.
It gives me error 422 when I drag the file into the project, and it doesn't explain anything.
It gives me an upload error when I import the .aix file from my computer, and it just says upload error, and it doesn't explain anything. If there were any, I'd have written them to you.
there are others extensions to get manage-storage-permission ?
What is HTTP 422 Error? (Unprocessable Entity)
by mostafa
Oct 24, 2024
#http
AI
What is HTTP 422 Error? (Unprocessable Entity)
What is HTTP Error 422?
HTTP error 422 Unprocessable Entity occurs when the server understands the request but finds that the content is syntactically correct, yet semantically invalid. Essentially, the data you’re submitting may be well-formed, but something about it is incorrect or incomplete, making it impossible for the server to process.
What are HTTP 422 Error Causes?
The primary cause of a 422 error code is sending data that, while properly formatted, is not valid according to the server's expectations. This often happens with POST requests when submitting form data, JSON, or XML that contain formatting errors.
For example, submitting a invalid or even a well-formed JSON document that lacks required fields or contains invalid values could trigger a 422 error.
It’s important to ensure that the content being sent matches the server’s requirements, such as validation rules, data types, or required fields, to avoid this error.
@Taifun I'm so sorry,. the page had expired but it hadn't given me the message, so it gave me error 422 or upload error, now that I've refreshed the page it has accepted it, let's hope it works
Anyway, the Puravida search bar opens with Ctrl+F, but it only accepts text without searching for anything