mcmuney Posted July 31, 2009 Share Posted July 31, 2009 I'm using a script to upload photos, during the upload it adds additional information to the original filename, for example: $_GET['file_name']=$time."_".$mem_id._.$_GET['file_name']; $rfn=$_SERVER['DOCUMENT_ROOT']."/images/".$_GET['file_name']; So, if the filename was abc.jpg, it will upload it as 1177799496_1_abc.jpg. PROBLEM: When there's a [] in the file name, like abc[1].jpg, having the [] causes a load issue. What can I add to remove the [] from the file during the rename process? Thanks in advance. Link to comment https://forums.phpfreaks.com/topic/168242-solved-file-renamingextracting/ Share on other sites More sharing options...
Zyx Posted July 31, 2009 Share Posted July 31, 2009 Use strtr() function: echo strtr($filename, '[]', '__'); It will replace the square brackets with underscores. Link to comment https://forums.phpfreaks.com/topic/168242-solved-file-renamingextracting/#findComment-887413 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.