# Help php!

**URL:** <https://forum.kirupa.com/t/help-php/29894>\
**Category:** Uncategorized\
**Created:** [September 1, 2003, 5:27pm UTC](https://forum.kirupa.com/t/help-php/29894 "2003-09-01T17:27:41Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![jazzman121](https://yyz1.discourse-cdn.com/flex011/user_avatar/forum.kirupa.com/jazzman121/32/127_2.png) [@jazzman121](https://forum.kirupa.com/u/jazzman121)\
**Post date:** [September 1, 2003, 5:27pm UTC](https://forum.kirupa.com/t/help-php/29894/1 "2003-09-01T17:27:41Z")

</div>

OK here is my multiple file uploading file script

```auto

&ltinput type="file" name="userfile[]" size="20" enctype="multipart/form-data">

```

i have 4 upload file inputs  
in my page

and the php script im using is

```php

$files = $HTTP_POST_FILES['userfile'];
	if(!empty($userfile[0])) {
		if(is_uploaded_file($userfile[0])){
			move_uploaded_file($userfile[0], "/ft_files/1.jpg"); 
		}
	}

```

when i upload a file using the first input… i dont know why it doesnt upload the file… could someone help me??? at [php.net](http://php.net) they said for multiple uploads use ‘userfile’ as an array

thanks

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 1, 2003, 5:38pm UTC](https://forum.kirupa.com/t/help-php/29894/2 "2003-09-01T17:38:07Z")

</div>

actually, its this:

```php
$files = $HTTP_POST_FILES["userfile"];
    if(!empty($userfile[0])) {
        if(is_uploaded_file($userfile[0])){
            move_uploaded_file($userfile[0], "/ft_files/1.jpg"); 
        }
    }

```

always use double quotes with arrays.

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 1, 2003, 5:44pm UTC](https://forum.kirupa.com/t/help-php/29894/3 "2003-09-01T17:44:27Z")

</div>

tried it dint work ☹ … the path is it relative to the folder the php file is in?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 1, 2003, 5:57pm UTC](https://forum.kirupa.com/t/help-php/29894/4 "2003-09-01T17:57:57Z")

</div>

try

```php

$files = $_FILES['userfile'];
if(!empty($files[0])) {
 if(is_uploaded_file($files[0])){
move_uploaded_file($files[0], "/ft_files/1.jpg"); 

```

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 1, 2003, 7:12pm UTC](https://forum.kirupa.com/t/help-php/29894/5 "2003-09-01T19:12:48Z")

</div>

nope that dint work either ☹ dont know wats wrong… i have even made sure the folder is chmod to write

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 1, 2003, 7:18pm UTC](https://forum.kirupa.com/t/help-php/29894/6 "2003-09-01T19:18:24Z")

</div>

ok this is what i did

```php
$files = $_FILES['userfile'];
echo $userfile[0];

```

and the result i got was

C:\Documents and Settings\user\Desktop  
ame.jpg

how do i remove the \ and make it only \

?? thanks i think that might work

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 1, 2003, 7:55pm UTC](https://forum.kirupa.com/t/help-php/29894/7 "2003-09-01T19:55:34Z")

</div>

ok i tried this out

```php
$userfile = str_replace("\\", "&#92;", $userfile);

```

now that worked but this is what happened to the result…

C:\Documents and Settings\user\Desktop  
ame.jpg

same result then i tried changing it to another charc to see if the str\_replace works and it worked

i replaced the \ with + and it worked and i got this as the result

C:++Documents and Settings++user++Desktop++name.jpg

why is it doubling that char ? i dont understand

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 1, 2003, 8:18pm UTC](https://forum.kirupa.com/t/help-php/29894/8 "2003-09-01T20:18:14Z")

</div>

ok i figured it out i just did this

```php

$userfile = str_replace("\\\\\\\\", "\\\\", $userfile);

```

to get this

C:\Documents and Settings\user\Desktop  
ame.jpg

dint understand why thou …

BUTT the

```php
$files = $HTTP_POST_FILES["userfile"];
    if(!empty($userfile[0])) {
        if(is_uploaded_file($userfile[0])){
            move_uploaded_file($userfile[0], "/ft_files/1.jpg"); 
        }
    }

```

still aint working ☹

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 1, 2003, 9:14pm UTC](https://forum.kirupa.com/t/help-php/29894/9 "2003-09-01T21:14:26Z")

</div>

I was thinking do i have to put

/var/www/html/

or something before the url?

---

<div class="post-metadata">

**Author:** ![system](https://canada1.discourse-cdn.com/flex011/uploads/kirupa/original/3X/6/2/621e5c11736f46532526e61be85940af4230f3e5.png) [@system](https://forum.kirupa.com/u/system)\
**Post date:** [September 4, 2003, 8:03pm UTC](https://forum.kirupa.com/t/help-php/29894/10 "2003-09-04T20:03:01Z")

</div>

try with copy()

```php
if(@is_uploaded_file($_FILES["userfile"]["tmp_name"])) {
copy($_FILES['userfile']['tmp_name'], "/ft_files/1.jpg");
}

```
