Jump to content


Photo

File copying help


  • Please log in to reply
6 replies to this topic

#1 diar33

diar33
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 02 August 2006 - 09:48 PM

Hi there,
  I am trying to change one file in about 300 directories, all of which reside in one main directory. The file is the same in each. Is there a way to copy a new file into each of these directories to overwrite the old one automatically using php?

Thanks in advance,

TValdes

#2 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 02 August 2006 - 10:24 PM

Why do you have the same file in multiple directories?
Cant you just always link to the same one?
Tell me the problem, I will try tell you the solution

#3 diar33

diar33
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 03 August 2006 - 04:44 AM

Here's teh situation: Members of the site are allowed to post photos, which are stored in randomly named directories. The server the site's on wont allow for much security, so in the case that someone finds the folder name, they will be able to see that members photos even if not a member of the site. To fix that, there is an index file in each directory which throws them back to the site's index. However, it goes to a bad link, actually another site I did the same thing for.. which is bad.

#4 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 03 August 2006 - 04:48 AM

use 1 folder and the index idear and name the photo via user id.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#5 ryanlwh

ryanlwh
  • Staff Alumni
  • Advanced Member
  • 511 posts

Posted 03 August 2006 - 05:00 AM

if you could and if your host allows it, add a .htaccess file in your root and deny access to file having the image extensions.
Please use EDIT * 100...
Please use
or [php] * 1000...

PLEASE READ THE POSTED SOLUTIONS CAREFULLY * 1000000...

#6 diar33

diar33
  • Members
  • PipPip
  • Member
  • 13 posts

Posted 03 August 2006 - 05:46 AM

Those wouldn't work, as the host doesn't allow .htaccess, and the members are allowed to have multiple photos, though it could still be done this way I suppose.

Either way, I still need a way to change what's currently there, as there are over 300 members with pictures and going through each and changing it is a complete nightmare. The site is live and I couldn't just go and delete everyone's current pictures.

Thanks for the replies,

TValdes

#7 onlyican

onlyican
  • Members
  • PipPipPip
  • Advanced Member
  • 921 posts
  • LocationHants - UK

Posted 03 August 2006 - 10:20 AM

What I do on these
Get the Unique User ID number
Get a DateStamp
I normally only have one upload as its for profiles so this will do for me
$user_id = $id; //This is the users unique ID
$stamp = date("Y-m-d H:i:s");
$new_file_name = $id."_".$date.".".$ext

The name is always unique, this stops against accidently overwriting.
//I Normally get the file ext, to check it is jpg || gif..... That is what the $ext is


Tell me the problem, I will try tell you the solution




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users