Jump to content

file upload in php5


saeedm

Recommended Posts

I test this code in PHP4, It work well,

but in freeBSD and PHP5 I get error # 6 ($_FILES['pictures']['error'])

the main code is:

[codes]

<form action="new.php" method="post" enctype="multipart/form-data">

<p>Pictures:

<input type="file" name="pictures[]" />

<input type="file" name="pictures[]" />

<input type="file" name="pictures[]" />

<input type="submit" value="Send" />

</p>

</form>

 

<?php

 

foreach ($_FILES["pictures"]["error"] as $key => $error)

{

if ($error == UPLOAD_ERR_OK)

{

$tmp_name = $_FILES["pictures"]["tmp_name"][$key];

$name = $_FILES["pictures"]["name"][$key];

move_uploaded_file($tmp_name, "data/$name");

}

}

 

?>

 

[/codes]

 

What's wrong with this code or PHP5?

 

 

Link to comment
https://forums.phpfreaks.com/topic/41473-file-upload-in-php5/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.