Re: fread question
| From: | MikeP | Date: | Thu, 18 Dec 2008 16:09:00 +0000 |
| Subject: | Re: fread question | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-284795@lists.php.net to get a copy of this message | ||
you have magic_quotes_runtime turned on LOCALLY. Use phpinfo() to see.
NOmagic_quotes_runtime Off
you actually managed to put the backslashes into your text file.
NO
<td><input name="letter" type="file" id="letter"
size="50" maxlength="255"
/>
.
.
.
.
<?php
process_uploaded_file('letter');
function process_uploaded_file($fname) {
// Assumes set of $_POST variables in the form: name, name_fname,
name_size, name_type
$_POST[$fname.'_fname'] = $_FILES[$fname]['name'];
$_POST[$fname.'_size'] = $_FILES[$fname]['size'];
$_POST[$fname.'_type'] = $_FILES[$fname]['type'];
$_POST[$fname.'_fname'] = strtr($_POST[$fname.'_fname'],'
%&*;:"{}[]|\<>,/()%$#@!','________________________'); //fix special
chars in
name
$_POST[$fname.'_fname'] =
strtr($_POST[$fname.'_fname'],"'","_");
$fileHandle = fopen($_FILES[$fname]['tmp_name'], "r");
$_POST[$fname] =stripslashes(fread($fileHandle,
$_POST[$fname.'_size']));
Neither
<ceo@l-i-e.com> wrote in message
news:20081218155854.69674.qmail@o2.hostbaby.com...
>
> PHP does *not* do the addslashes on $_POST when you cram something into it
> in your PHP code.
>
> It does it during the process of auto-filling up $_POST.
>
> So either:
> A) you have magic_quotes_runtime turned on LOCALLY. Use phpinfo() to see.
> B) you actually managed to put the backslashes into your text file.
>
> PS
> You really shouldn't be cramming data into $_POST, imho.
> Too confusing for later development/maintenance.
> $_POST should be "read only"
> Copy the parts of $_POST you want into something else, and add in your
> file contents as well.
>