B4A Library Upload file with php

Version 1.0

Requirements:
1- B4A 3.x
2- Copy the UploadFilePhp.xml and UploadFilePhp.jar to your additional libraries directory.

eng

Sorry for my English I translate with google!
This library is used to upload files to the web server through php page.
B4A sends the file to the php page that saves them in the server folder!
ita
Scusate il mio inglese traduco con google!
questa libreria serve a uplodare file nel web server attraverso pagina php.
B4A invia i file alla pagina php che li salva nella cartella del server!


eng
simple php page to be included in your server!
ita
semplice pagina php da inserire nel vostro server!

problem 3g
I only have problems with slow connections with Android 2.3.0



B4X:
Eng
Be careful when you do the tests do not send the same file, change it generates an error if no "why the file on the server can not be written when you are opening!"
Ita
Attenzione quando fate le prove non inviate lo stesso file,cambiatelo se no genera un errore "motivo il file sul server non può essere scritto quando è apperto!"

Attention this code and sample files !!!!
security change you as you please do not take any responsibility!

ITA
Attenzione questo codice e file di esempio!!!!
per la sicurezza modificarlo voi a vostro piacimento non mi prendo alcuna responsabilità!



B4X:
<?php
    $file_path = "uploads/";

    $file_path = $file_path . basename( $_FILES['uploaded_file']['name']);
    if(move_uploaded_file($_FILES['uploaded_file']['tmp_name'], $file_path)) {
        echo "success";
    } else{
        echo "fail";
    }
?>
B4X:
Dim Up As UploadFilePhp

Up.Initialize("Up")
Up.doFileUpload( ProgressBar1,Label1,Path_Phone_Image & name_image,Url_Php_Page)
 

Attachments

  • UploadfilePhp.zip
    9.7 KB · Views: 1,683
Last edited:

PoleStar

Member
Licensed User
Longtime User
to upload an image in mysql you must use the library mysql
This library is used to upload images or files to a web server or web space
thanks
Can change the "name_image" when uploading in web space ?
Example: FileName & rnd(0,1000).jpg
In order to avoid uploading files with names similar...
 

manuel-r

Member
Licensed User
Longtime User
Hi @all
Nice lib but i have one problem with it:
If I use the library in a service it seems that the <SendFile>-Event is never fired? Is this a bug or feature?
The only thing I can see are many log-entries like "Ignoring event: upload_sendfile" and "Ignoring event: upload_statusvisible"
 

Spinter

Active Member
Licensed User
Longtime User
I've never run in a service can not tell you because it generates an error!
if you want I can look but send me the sample application.
 

manuel-r

Member
Licensed User
Longtime User
Ooooops, sorry.
I've made a mistake. I started the service. Inside it the file uploads were called. After all uploads were triggered I let stop the service. So it's clear that the upload events were ignored.
 

Unni.Haarish

New Member
Licensed User
I want to upload small text file. i had used in previous android versions. now i am trying in Android 10. This library is not supporting to upload. my php files are working fine. No Errors raised, But file is not uploading. What to do? No idea
 

DonManfred

Expert
Licensed User
Longtime User
Top