Yoko Yoko - 1 year ago 86
HTML Question

Sending file input doesn't work

I want to send a file by a form, but I don't undersand why, after the post the data of file is always empty.

All others data that I sent inside form, I haven't problem, just if I want to send a file.

An idea ?

<form name="contact" action="mysite.com/boutique/index.php?Info&Contact&Process&action=process" method="post" enctype="multipart/form-data">
<input type="hidden" name="formid" value="d190f7c98c1f66b7147e0d239a1e23ce" />

<div class="controls col-md-6">
<input type="file" name="evidence_document" id="file" class="form-control" />

<button type="submit" class="btn btn-primary">Continuer</button>

an example about my test: like you can see evidence_document doesn't exist !

array(9) {
["formid"]=> string(32) "d190f7c98c1f66b7147e0d239a1e23ce"
["name"]=> string(13) "test"
["email"]=> string(30) "test@testt.com"
["customers_telephone"]=> string(14) "09 88 55 44 55"
["customer_id"]=> string(1) "1"
["order_id"]=> string(1) "2"
["email_subject"]=> string(14) "fdgdsfgdsfgsdf"
["enquiry"]=> string(23) "gdgsdfgdsfgsdfgfdsgfdsg" ["number_email_confirmation"]=> string(1) "5"

Addition information

object(ClicShopping\OM\Upload)#38 (8) {
["_file":protected]=> string(17) "evidence_document"
["_filename":protected]=> NULL
["_destination":protected]=> string(61) "/var/www//boutique/sources/download/Evidence"
["_permissions":protected]=> int(511)
["_extensions":protected]=> array(2) {
[0]=> string(3) "mp4"
[1]=> string(3) "jpg" }
["_replace":protected]=> string(9) "201610_2_"
["_upload":protected]=> array(0) { }
["_maxsize"]=> NULL } NULL

Answer Source

You can not find the file on the post array. They are coming with the $_FILES array.

$_FILES['evidence_document']; // your file is here

not on;

Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download