Page 1 of 1

Problems uploading files

Posted: Wed Apr 05, 2006 8:08 am
by Prismax
feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]


Hi,

I have this weird problem with uploading some files.

I use a HTML-form, with the following input somewhere :

Code: Select all

<tr><td>Banner:</td><td><input type="file" name="newbanner" size="40"></td></tr>
The form tag is like :

Code: Select all

<form action="updateaction.php" enctype="multipart/form-data" method="post">
When i look at updateaction.php I have the following code :

Code: Select all

if ((is_uploaded_file($_FILES['newbanner']['tmp_name'])) and (strlen($_FILES['newbanner']['name']) > 0)){
	move_uploaded_file($_FILES['newbanner']['tmp_name'],'../../brand/'.$_FILES['newbanner']['name']);
}
However it doesn't work. Even weirder : when I do a

Code: Select all

echo $_FILES['newbanner']['name']
I get nothing (string length also is zero). Does anyone have any idea why this is?


feyd | Please use

Code: Select all

and

Code: Select all

tags where appropriate when posting code. Your post has been edited to reflect how we'd like it posted. Please read:  [url=http://forums.devnetwork.net/viewtopic.php?t=21171]Posting Code in the Forums[/url] to learn how to do it too.[/color]

Posted: Wed Apr 05, 2006 10:01 am
by ed209
what happens when you:

Code: Select all

print_r($_FILES);
also, have you changed the permissions on 'brand/' ?

Empty $_FILES

Posted: Wed Apr 05, 2006 12:40 pm
by audz
Hi,

I am new to PHP so please bear with me. :)

I have the same problem. I tried print_r($_FILES) but its empty. What could be the cause of this?

I would appreciate any help!

Re: Empty $_FILES

Posted: Wed Apr 05, 2006 12:45 pm
by feyd
audz wrote:Hi,

I am new to PHP so please bear with me. :)

I have the same problem. I tried print_r($_FILES) but its empty. What could be the cause of this?

I would appreciate any help!
an empty $_FILES means nothing was submitted that was a file upload field.

Empty?

Posted: Wed Apr 05, 2006 2:33 pm
by audz
Why would it be empty?

Posted: Wed Apr 05, 2006 4:36 pm
by Prismax
First of all, I'm very sorry to the moderators. I didn't notice the PHP tag, only the Code tag, but I'll make sure I'll do it right in the future.

I tried the print_r($_FILES) but it was empty. As you can see in my code I use the appropriate HTML input parameters....

I still haven't been able to solve this one....

Posted: Wed Apr 05, 2006 4:51 pm
by feyd
where in the HTML does the <form> tag lie? Are you running a DOCTYPE in the page?