Buy Now
Sign in

Allow single file upload only

Yudhizth , November 20 2017
Y
Yudhizth
Dear all,
How to make a file upload allow only single file ? because the user accidentally choose more than one file on file upload window and the file upload is not saved to server and DB.

Thankyou
GreyHead
Hi Yudhizth ,

I've not seen this reported before - can the user select more than one file if the 'Multi' option isn't set?

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much
Y
Yudhizth
I'm sorry before, that is just my hypothesis. No they can't, because I'm using a hardcode array to save an url of file, name of file and an ID of another table. Like this one

<?php


if($form->data["file5"] !=""){
$form->data["fileupload"]["4"]["url"] = $form->files["file5"]["link"];
$form->data["fileupload"]["4"]["id"] = $form->data["id"];
$form->data["fileupload"]["4"]["nama"]=$form->data["nfile5"];
}
if($form->data["file6"] !=""){
$form->data["fileupload"]["5"]["url"] = $form->files["file6"]["link"];
$form->data["fileupload"]["5"]["id"] = $form->data["id"];
$form->data["fileupload"]["5"]["nama_berkas"]=$form->data["nfile6"];
}
if($form->data["file7"] !=""){
$form->data["fileupload"]["6"]["url"] = $form->files["file7"]["link"];
$form->data["fileupload"]["6"]["id"] = $form->data["id"];
$form->data["fileupload"]["6"]["nama"]=$form->data["nfile7"];
}
?>


Somehow, there is a case one or more of the file doesn't save to a server, I have define all file field on File Upload setup, and define all file on code above. I try to figure it out, but still have no solution. Maybe you can give me a suggestion on this case. Thank you
GreyHead
Hi Yudhizth,

Sorry but I'm lost- I have no idea exactly what your question is?

Bob
ChronoForms technical support
If you'd like to buy me a coffee or two, thank you very much