-
\\ is normal now in HTML5. It acts as \.
I am sure about this because I tested both versions :
C:\\wamp\\www\\noyaevofis\\images\\block.png
and
C:\wamp\www\noyaevofis\images\block.png
The explorer takes \\ as \.
For your last post about $_FILES :
$_FILES['file_name']['name'] gives only the name and extension of the file but not the full path.
I spent all my afternoon yesterday for working on $_FILES, but no use.
I still have hope.
Nejat
-
But this is php that's processing the file names. Just leave it as one forwardslash ("/").
-
Well done, but I have allready tested it also.
-
OK, but for future reference, it should be left as only one slash.
-
I can imagine that.
I have the below lines in my code for this future danger :
PHP Code:
$find =chr(92).chr(92) ;
$logoAdres = str_replace($find,chr(92),$logoAdres);
Thank you.
Nejat
-
I solved the problem today at 10:33 GMT+3.
It has nothing to do with neither php version nor directory structure/naming.
It is because of the way that HTML5 handles the POSTed data. Depending on this change in HTML5, the copy() function is handling the source file as : "The source file of the copy() function must be the temp_name not the full path."
$recName = $_FILES['file_name']['tmp_name']
This link may give a brief idea about new HTML5 and DOM specs. : http://www.mail-archive.com/whatwg@l.../msg14076.html
The following final code is tested on 2 different remote servers for IE and FireFox. No errors occured, all the files POSTed were saved into the related directories in both explorers.
PHP Code:
<?php
if (!isset($_REQUEST['PLogo'])) {$PLogo="";} else $PLogo = $_REQUEST['PLogo'] ;
if (!isset($_REQUEST['Pname'])) {$Pname="";} else $Pname = $_REQUEST['Pname'] ;
if (!isset($_REQUEST['action'])) {$action="";} else $action = $_REQUEST['action'] ;
?>
<form name="Fedit" method="post" enctype="multipart/form-data">
<table align="center" width="600" cellspacing="2" cellpadding="2" style="border:1px outset #ECECEC;">
<tr>
<td bordercolor="#ececec" class="urunkart">Logo : </td>
<td bordercolor="#ececec">
<input type="file" name="PLogo" size="70" style="font:7pt verdana;color:#003399" >
</td>
</tr>
<tr>
<td bordercolor="#ececec" class="urunkart">Name for Logo : </td>
<td bordercolor="#ececec"><input type="text" name="Pname" size="50" maxlength="255" style="font:7pt verdana;color:#003399"></td>
</tr>
<tr>
<td bordercolor="#ececec" align="center" colspan="2">
<input type="submit" name="action" value="Save" onmouseover="this.style.cursor='pointer';">
</td>
</tr>
</table>
</form>
<?
$action = strtolower(trim($action));
switch($action)
{
case"save" : action_update($PLogo,$Pname);
break;
}
function action_update($PLogo,$Pname)
{
$PLogo = $_FILES['PLogo']['tmp_name'] ;
if ($PLogo !=="" )
{
chdir("./logo");
if (copy($PLogo, $Pname)) { echo ("$PLogo saved"); } else { echo ("$PLogo is not saved"); }
chdir("..");
}
}
?>
I thank all of you for your valuable supports.
Nejat