Jump to content

[SOLVED] Upload Array help


dennismonsewicz

Recommended Posts

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

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?

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.