Android Question I want how to upload multiple images to the server

AlfaizDev

Well-Known Member
Licensed User
I want to upload them as images to use in my app
Because it is in zip format, you need to decompress the server
 
Upvote 0

yfleury

Active Member
Licensed User
Longtime User
Just to be sure. You want to take an image from a server and put it to your app. That's right ?
 
Upvote 0

eps

Expert
Licensed User
Longtime User
I don't understand? Just take the code from the example you posted. Add in an argument of 'filename' and then call the sub with the filename you want to upload.. Loop through the list in some way.
 
Upvote 0

DonManfred

Expert
Licensed User
Longtime User
He want to upload multiple images to php.
As i already answered in the other thread the PHP-Script must support it.
Basically on B4A-Side PostMultipart is perfect. Even for multiple Images.

The PHP-Script must be able to handle them.
PHP:
<?php
if(isset($_POST['submit'])){
// Count total files
$countfiles = count($_FILES['file']['name']);

// Looping all files
for($i=0;$i<$countfiles;$i++){
   $filename = $_FILES['file']['name'][$i];

   // Upload file
   move_uploaded_file($_FILES['file']['tmp_name'][$i],'upload/'.$filename);
  
}
}
?>

BTW: I found this code within 10 seconds Googling "handle multiple uploaded file with php"
 
Last edited:
Upvote 0

AlfaizDev

Well-Known Member
Licensed User
He want to upload multiple images to php.
As i already answered in the other thread the PHP-Script must support it.
Basically on B4A-Side PostMultipart is perfect. Even for multiple Images.

The PHP-Script must be able to handle them.
PHP:
<?php
if(isset($_POST['submit'])){
// Count total files
$countfiles = count($_FILES['file']['name']);

// Looping all files
for($i=0;$i<$countfiles;$i++){
   $filename = $_FILES['file']['name'][$i];

   // Upload file
   move_uploaded_file($_FILES['file']['tmp_name'][$i],'upload/'.$filename);
 
}
}
?>

BTW: I found this code within 10 seconds Googling "handle multiple uploaded file with php"
What about b4a side
What is the code
 
Upvote 0

jkhazraji

Active Member
Licensed User
Longtime User
Add the following code to the above PHP script and run it inside a webview of b4a
PHP:
<form method='post' action='' enctype='multipart/form-data'>
 <input type="file" name="file[]" id="file" multiple>

 <input type='submit' name='submit' value='Upload'>
</form>
then you can choose files to upload by clicking the submit button. The php file must reside in the parent directory of '/upload' above. You can use the 'localhost' as a server
 
Upvote 0
Top