I have a lot of forms contained within a CMS I created. They have all been working fine up until today. The issue I am having is related to files being uploaded and the $_FILES array containing odd characters.
Contained within a form I have:
<tr>
<td>Related PDF File:</td>
<td><input type="file" name="pdfFile" size=50" value="<? pv($frm["pdfFile"]) ?>"></td>
</tr>
On submit it returns back to my script and I validate if the field has a file submitted:
if($_FILES['pdfFile']['name'] != '' && $_FILES['pdfFile']['error'] == 0) {
$up_file->save($CFG->dirroot . "/docs/services/", "pdfFile", 1);
$frm['pdfFile'] = $up_file->getFilename('pdfFile');
}
The issue is if I display my $_FILES array when the field has nothing submitted I get the following:
Array
(
[pdfFile] => Array
(
[name] => ò…
[type] =>
[tmp_name] =>
[error] => 4
[size] => 0
)
)
The [name] has some funky special characters within. Has anyone ever seen this? It is only happening on one of my servers. And if the input field actually has a submitted file, there is no issue.
Thanks in advance for any comments.
$frm["pdfFile"]? By the way you can't set it like that. Otherwise you could upload files from a user's computer without the user knowing it.ò(as you name it), it's just a character. What's your problem with it?