/    Sign up×
Community /Pin to ProfileBookmark

uploading multiple files

i can upload one file but i have problems uploading more than one file

can anyone tell me how to work with this i had look into the internet but most of the stuff out there is for a single file

this is my script to upload the file

[code=php]

$uploaddir = ‘/home/townsfin/public_html/business_images/’;
$uploadfile = $_FILES[‘Picture1’][‘name’];

if(!empty($_FILES[‘Picture1’])){
var_dump($uploaddir);

var_dump($_FILES[‘Picture1’][‘size’]);
var_dump($_FILES[‘Picture1’][‘error’]);
var_dump($_FILE);
var_dump($_FILES[‘Picture1’][‘type’]);
var_dump($_FILES[‘Picture1’][‘name’]);

var_dump($_FILES[‘Picture2’][‘name’]);
var_dump($_FILES[‘Picture2’][‘size’]);
var_dump($_FILES[‘Picture2’][‘error’]);
var_dump($_FILE);
var_dump($_FILES[‘Picture2’][‘type’]);
}

$fullpath = $uploaddir . $uploadfile;

if (move_uploaded_file ($_FILES[‘Picture1’][‘tmp_name’], $fullpath) )

{

echo(“File Uploaded”);

$sql=”INSERT INTO `business_info`(`BusinessName`,`Slogan`,`Business_Address`,`Tel`,`Website`,`Email`,
`Fax`,`type`,`make`,`Categories`,`Keyword`,`Picture1`,`Headline`,`Slogan2`,`Description1`,`Description2`,`Description3`,
`Picture2`,`Picture3`,`User_Name`,`Password`)

Values(‘$BusinessName’,’$Slogan’,’$Business_Address’,’$Tel’,’$Website’,’$Email’,’$Fax’,’$type’,’$make’,’$Categories’,’$Keyword’,
‘$fullpath’,’$Headline’,’$Slogan2′,’$Description1′,
‘$Description2′,’$Description3′,’$fullpath’,’$fullpath’,’$User_Name’,’$Password’)”;

$result = mysql_query($sql);
if (!$result){
echo “Error inserting data: ” . mysql_error();
}
}
else {
echo (“file no uploaded!”);
print_r($_FILES);
echo realpath(‘./’);
}
?>
[/code]

html form

[code=php]

<td>

Picture1
<input name=”Picture1″ type=”file”>

</td>
</tr>
<tr>
<td>Picture 2
<input name=”Picture2″ type=”file”>
</td>
</tr>
<tr>
<td>Picture 3 <input name=”Picture3″ type=”file”></td>
</tr>
<tr>
<td>
Audio
<input name=”Audio” type=”file”></td>
</tr>
<tr>
<td>
Video
<input name=”video” type=”file”</td>
</tr>
[/code]

please help how can i upload all this file into my database

to post a comment
PHP

1 Comments(s)

×

Success!

Help @franknu spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.19,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...