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? Link to comment https://forums.phpfreaks.com/topic/129292-solved-upload-array-help/ 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? Link to comment https://forums.phpfreaks.com/topic/129292-solved-upload-array-help/#findComment-670300 Share on other sites More sharing options...
dennismonsewicz Posted October 20, 2008 Author Share Posted October 20, 2008 bump Link to comment https://forums.phpfreaks.com/topic/129292-solved-upload-array-help/#findComment-670372 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 />"; Link to comment https://forums.phpfreaks.com/topic/129292-solved-upload-array-help/#findComment-670396 Share on other sites More sharing options...
dennismonsewicz Posted October 21, 2008 Author Share Posted October 21, 2008 Sweet thanks bud! Link to comment https://forums.phpfreaks.com/topic/129292-solved-upload-array-help/#findComment-670804 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.