Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

File upload problem 1

Status
Not open for further replies.

smashing

Programmer
Joined
Oct 15, 2002
Messages
170
Location
US
Hi Everyone!!

copy($_FILES
[tmp_name], "/ .$_FILES
[name]) or die("could not copy the file.");


I have the above line in a PHP script that uploads files to a folder on the server - It works perfectly fine one of my client's servers.

I take that very same script and try to use it on a different server & it doesn't work ie (I get the die message that I specify).
It is not a permissions issue, the web host people are telling me that it must be something in the php.ini file or something to that nature that has to be modified.
What settings have to be enabled to accept files ?
 
Gee, where's the message?
 
I got it to work thanks. There's another issue here though,

copy($_FILES
[tmp_name], "/ .$_FILES
[name]) or die("could not copy the file.");

That will successfuly copy $_FILES
[tmp_name] to $_FILES
[name] and place it on the server.

But if I want to output a thank you message to the person sending the file and echo the file name to them like this:

Thank you we received $_FILES
[name]

What really displays is this:

Thank you we received Array[name]

Whats the problem here?
 
Where would I put the quotes in my example??
 
As a general rule, it is good coding practice to write:

$_FILES['img1']['name']

or

$_FILES["img1"]["name"]

Rather than just

$_FILES
[name]

using no quotes makes your script PHP-setting dependent.

Want the best answers? Ask the best questions: TANSTAAFL!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top