Reputation: 899
I'm using Formidable Pro and I create a hook to get all the data after the submit (Don't want to pay the addon API). I modify the action of the form to go to my PHP script after submitting. I just have a problem now, the form is used also to send images and PDF files.
I try to move the images and PDF files after the submitting, with move_uploaded_file but nothing works. I display the infos of $_FILES and I have this infos :
array(
[name] => Array
(
[0] => compte_rendu_12-12-16.pdf
)
[type] => Array
(
[0] => application/pdf
)
[tmp_name] => Array
(
[0] => /tmp/phpHCenke
)
[error] => Array
(
[0] => 0
)
[size] => Array
(
[0] => 176072
)
)
Here is my PHP code :
$uploaddir = '/var/www/uploads/';
$uploadfile = $uploaddir . basename($_FILES['file70'][0]['name']);
echo '<pre>';
if (move_uploaded_file($_FILES['file70'][0]['tmp_name'], $uploadfile)) {
echo "Upload with success";
} else {
echo "Upload error";
}
I always have the message "upload error".
Any idea ?
Upvotes: 0
Views: 52
Reputation: 94682
The $FILES array should be referenced as
$_FILES['file70']['name'][0]
when multiple files are being uploaded
Upvotes: 1