tayys Posted July 27, 2011 Share Posted July 27, 2011 Greetings, My codes stated below works well in window xp. But, when i browse in window 7, it only display the file name instead of the full directory. Can anyone help me with this. Thanks in advance. Regards, Juz <?php include_once"../connectDB.php"; $tbl_name1="displaydata"; if (isset($_POST['submit'])) { $fname1=$_POST['sel_file']; $chk_ext=explode(".", $fname1); if(strtolower($chk_ext[1])=="csv") { $filedir=$_POST['sel_file']; $filedir=addslashes($filedir); mysql_query("UPDATE $tbl_name1 SET ShippingDirectory='$filedir' WHERE DataID=1"); $message="Shipping1 has been updated."; } else { $message="*Wrong format of file."; } } ?> <html> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <meta http-equiv="X-UA-Compatible" content="IE=7" /> <script type="text/javascript"> </script> <form action='<?php echo $_SERVER["PHP_SELF"];?> 'method='post'> <div> <p><font><b>Change File Directory</b></font></p> </div> <div> <table> <tr> <td>Shipping file: </td> <td><input type='file' name='sel_file' id= 'sel_file' size='20'></td> <td><input type='submit' name='submit' value='submit'></td> </tr> <tr> <td></td> <td align="right"><input type='submit' name='submit3' value='Default'></td> </tr> </table> </div> <div> <table border="1"> <tr> <td>Shipment file path: </td> <td> <?php $sql1="SELECT * FROM $tbl_name1"; $result1 = mysql_query($sql1) or die(mysql_error()); $row1 = mysql_fetch_array($result1); $s="{$row1['ShippingDirectory']}"; echo $s; ?> </td> </tr> <tr> <td colspan=2><?php echo $message?></td> </tr> </table> </div> </form> </html> Link to comment https://forums.phpfreaks.com/topic/242915-why-the-directory-displayed-in-window-xp-is-different-from-that-in-window-7/ Share on other sites More sharing options...
xyph Posted July 27, 2011 Share Posted July 27, 2011 This seems to be a browser issue, not an OS issue. The browser should never return the full path to the file for file inputs. You should, instead, read the value from the temporary file created and stored in the $_FILES array. Link to comment https://forums.phpfreaks.com/topic/242915-why-the-directory-displayed-in-window-xp-is-different-from-that-in-window-7/#findComment-1247705 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.