kanjigirl Posted March 27, 2007 Share Posted March 27, 2007 I have a form that includes this snippet of code that rewrites the filename for an image to be uploaded: foreach ($images as $image) { $sfname = preg_replace('/[^a-zA-Z]/','',$_POST['fname']); $new_name = $sfname[0] . '_' . preg_replace('/[^a-zA-Z]/','',$_POST['lname']) . '_' . $id . '-' . ($i + 1) . '.' . $extensions[$i]; move_uploaded_file($_FILES[$image]['tmp_name'],$IMAGE_DIR . $new_name); $file = fopen($IMAGE_DIR . $new_name,"r"); A user keeps getting the message "Warning: preg_replace() [function.preg-replace]: Unknown modifier '4' in /home/fcmoca/public_html/studiotour/process-entry.php on line 317" whenever he tries to submit. His .jpg file has spaces and a hyphen in it, and I thought that might be the problem, but I tried it myself with his file and it uploaded fine for me. A typical filename would be "Cole Thompson - Two Trees in Snow.jpg." I'm new to PHP and have no clue why I would be able to upload his information but he can't. Can someone help me? Quote Link to comment Share on other sites More sharing options...
notepad Posted March 28, 2007 Share Posted March 28, 2007 It sounds like it might be a problem with his computer, since you can do it and he can't... Whats the link? I can test it for you too. Quote Link to comment Share on other sites More sharing options...
effigy Posted March 28, 2007 Share Posted March 28, 2007 Sounds like a delimiter problem, which I don't see. Where's line 317? Are there any other regexes in the code? Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.