dennismonsewicz Posted October 20, 2008 Share Posted October 20, 2008 I have this code: if(isset($_FILES['uploadedfile']['name'])) { foreach($_FILES['uploadedfile']['name'] as $key) { echo trim("uploads/" . $key, "uploads/"); } } The upload file input looks like this: echo '<label>Attach a file</label> <input type="file" name="uploadedfile[]" class="multi" />'; When I echo out the name of the file uploaded it is placing the string uploads/ at the end of the file... any ideas on how to fix this? Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted October 20, 2008 Author Share Posted October 20, 2008 ok i have adjusted my code: updated code: if(isset($_FILES['uploadedfile']['name'])) { foreach($_FILES['uploadedfile']['name'] as $key) { echo "uploads/" . $key . "<br />"; } } This code is adding an extra uploads/ and the end of the array... anyway of fixing this? Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted October 20, 2008 Author Share Posted October 20, 2008 bump Quote Link to comment Share on other sites More sharing options...
discomatt Posted October 20, 2008 Share Posted October 20, 2008 foreach($_FILES['uploadedfile']['name'] as $key) if ( !empty($key) ) echo "uploads/" . $key . "<br />"; Quote Link to comment Share on other sites More sharing options...
dennismonsewicz Posted October 21, 2008 Author Share Posted October 21, 2008 Sweet thanks bud! 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.