Welcome to the MacNN Forums.

If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

You are here: MacNN Forums > Software - Troubleshooting and Discussion > Developer Center > PHP copy file naming weirdness! Help a noob!

PHP copy file naming weirdness! Help a noob!
Thread Tools
Forum Regular
Join Date: Jul 2001
Location: Trapped in Amber
Status: Offline
Reply With Quote
Nov 9, 2003, 06:59 PM
 
Oh mighty webdev dieties, I implore thee for guidance! Strange doings are afoot!
Well, I think so anyway...
So I've got this PHP upload script working and can use it to upload files successfully from a Windows/IE client as well as a Mac/Safari/Mozilla setup, but all's not quite happy in Uploadtown. My script says this:


$file_name=str_replace("'","", $file_name);
$copy=copy($_FILES[ 'uploadfile'. $x]['tmp_name'],'/Sites/' & $file_name);

and when I echo $file_name in the page (to verify its value) it shows the correct file name. However, when the file is uploaded, it's got a weird string of seemingly random characters as a name. I don't think it's completely random, though, since a particular file gets the same weird name each time I upload it, and similarly named files have similar, but incorrect, names. I'm relatively new to web development, especially PHP, so I'm stumped. Any ideas, oh great and knowing ones?
I wanna see movies of my dreams.
     
Dedicated MacNNer
Join Date: Aug 2002
Status: Offline
Reply With Quote
Nov 9, 2003, 07:30 PM
 
what is that & doing there?

try a ".", the concatonation operator.

--will
[php]
$file_name=str_replace("'","", $file_name);
$copy=copy($_FILES[ 'uploadfile'. $x]['tmp_name'],'/Sites/' . $file_name);
[/php]
     
Forum Regular
Join Date: Jul 2001
Location: Trapped in Amber
Status: Offline
Reply With Quote
Nov 9, 2003, 08:58 PM
 
Originally posted by clam2000:
what is that & doing there?

try a ".", the concatonation operator.

--will
[php]
$file_name=str_replace("'","", $file_name);
$copy=copy($_FILES[ 'uploadfile'. $x]['tmp_name'],'/Sites/' . $file_name);
[/php]
That was it! I must have been stuck in ASP mode. Thanks for the quick reply
I wanna see movies of my dreams.
     
   
Thread Tools
Forum Links
Forum Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On
Top
Privacy Policy
All times are GMT -5. The time now is 02:24 PM.
All contents of these forums © 1995-2011 MacNN. All rights reserved.
Branding + Design: www.gesamtbild.com
vBulletin v.3.8.7 © 2000-2011, Jelsoft Enterprises Ltd., Content Relevant URLs by vBSEO 3.3.2