Welcome to the GoFuckYourself.com - Adult Webmaster Forum forums.

You are currently viewing our boards as a guest which gives you limited access to view most discussions and access our other features. By joining our free community you will have access to post topics, communicate privately with other members (PM), respond to polls, upload content and access many other special features. Registration is fast, simple and absolutely free so please, join our community today!

If you have any problems with the registration process or your account login, please contact us.

Post New Thread Reply

Register GFY Rules Calendar
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >
Discuss what's fucking going on, and which programs are best and worst. One-time "program" announcements from "established" webmasters are allowed.

 
Thread Tools
Old 07-23-2007, 04:56 PM   #1
Pipecrew
Master of Gfy.com
 
Pipecrew's Avatar
 
Industry Role:
Join Date: Feb 2002
Posts: 14,887
Need php help, quick question ;)

I have been building a few things lately for fun, This is a standard upload script, i am having trouble renaming the file, where in the code do i need to change so that i could have a random name or base the name off an Id?




$target_path = "uploads/";
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);


if(move_uploaded_file($_FILES['uploadedfile']['tmp_name'], $target_path)) {
echo "The file ". basename( $_FILES['uploadedfile']['name']).
" has been uploaded";
} else{
echo "There was an error uploading the file, please try again!";
}
Pipecrew is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-23-2007, 04:57 PM   #2
Masterchief
Confirmed User
 
Join Date: Jun 2006
Posts: 530
$target_path = $target_path . basename( $_FILES['uploadedfile']['name']);

the bold part is where you would place the name
Masterchief is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-23-2007, 04:58 PM   #3
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
The filename is set here: basename( $_FILES['uploadedfile']['name'])

$target_path = $target_path . 'thenamethatyouwant.jpg';

You can have it be what you want, you aren't forced to use the name that the file was uploaded with.
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-23-2007, 05:04 PM   #4
Pipecrew
Master of Gfy.com
 
Pipecrew's Avatar
 
Industry Role:
Join Date: Feb 2002
Posts: 14,887
Quote:
Originally Posted by StuartD View Post
The filename is set here: basename( $_FILES['uploadedfile']['name'])

$target_path = $target_path . 'thenamethatyouwant.jpg';

You can have it be what you want, you aren't forced to use the name that the file was uploaded with.
ahhh ok! so could i put a variable right there, if i was trying to name it based off an ID? like if the id is 16, its going to be 16.jpg?
Pipecrew is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-23-2007, 05:06 PM   #5
SomeCreep
:glugglug
 
SomeCreep's Avatar
 
Join Date: Mar 2003
Location: Where the Wild Things Are
Posts: 26,118
Pipecrew, off topic, but does Bang Bros know that something is wrong with the way they're tracking hits? I'm showing way less hits than normal for the past few days. Did you guys make some changes to the way you count hits? Are sales still being tracked normally?
__________________

Webair Hosting

I use and recommend Webair for hosting.
SomeCreep is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-23-2007, 05:08 PM   #6
Jman
Too lazy to set a custom title
 
Jman's Avatar
 
Industry Role:
Join Date: Sep 2003
Location: Canuckstikan
Posts: 22,722
Yo Pipecrew can you hit me up on ICQ when you have a second please. 124588247
__________________
Wowify AI API
Porn.AI
Affiliates Porn AI
email: [email protected]
Teams: jean.francois.laverdiere
TG: @jman1216
Jman is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-23-2007, 05:08 PM   #7
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
Quote:
Originally Posted by Pipecrew View Post
ahhh ok! so could i put a variable right there, if i was trying to name it based off an ID? like if the id is 16, its going to be 16.jpg?
Yup, could be what ever you want... and a variable would be a good idea since you use basename( $_FILES['uploadedfile']['name']) in your success message as well.
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-23-2007, 05:12 PM   #8
Pipecrew
Master of Gfy.com
 
Pipecrew's Avatar
 
Industry Role:
Join Date: Feb 2002
Posts: 14,887
Quote:
Originally Posted by SomeCreep View Post
Pipecrew, off topic, but does Bang Bros know that something is wrong with the way they're tracking hits? I'm showing way less hits than normal for the past few days. Did you guys make some changes to the way you count hits? Are sales still being tracked normally?
Ofcourse, with stuartd's help i am learning php to fix the system ;)

J/k, not in a hundred years, yes we know there is a problem and its being fixed. We had a database issue on bangbrosnetwork over the weekend and the people that wrote our affiliate software have been working on everything allday, there will be a redump of all data tommorow am.
Pipecrew is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-23-2007, 05:15 PM   #9
SomeCreep
:glugglug
 
SomeCreep's Avatar
 
Join Date: Mar 2003
Location: Where the Wild Things Are
Posts: 26,118
Quote:
Originally Posted by Pipecrew View Post
Ofcourse, with stuartd's help i am learning php to fix the system ;)

J/k, not in a hundred years, yes we know there is a problem and its being fixed. We had a database issue on bangbrosnetwork over the weekend and the people that wrote our affiliate software have been working on everything allday, there will be a redump of all data tommorow am.
Cool, thanks for the update.
__________________

Webair Hosting

I use and recommend Webair for hosting.
SomeCreep is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-23-2007, 05:16 PM   #10
Pipecrew
Master of Gfy.com
 
Pipecrew's Avatar
 
Industry Role:
Join Date: Feb 2002
Posts: 14,887
Quote:
Originally Posted by StuartD View Post
Yup, could be what ever you want... and a variable would be a good idea since you use basename( $_FILES['uploadedfile']['name']) in your success message as well.
thanks dude, sometimes problems need a fresh pair of eyes and experience ;) works like a charm now!
Pipecrew is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-23-2007, 05:48 PM   #11
StuartD
Sofa King Band
 
StuartD's Avatar
 
Join Date: Jul 2002
Location: Outside the box
Posts: 29,903
Quote:
Originally Posted by Pipecrew View Post
thanks dude, sometimes problems need a fresh pair of eyes and experience ;) works like a charm now!
Anytime... glad I could help.
And Masterchief was correct as well.
StuartD is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Old 07-23-2007, 06:00 PM   #12
WiredGuy
Pounding Googlebot
 
Industry Role:
Join Date: Aug 2002
Location: Canada
Posts: 34,469
I didn't know you were a coder
WG
__________________
I play with Google.
WiredGuy is offline   Share thread on Digg Share thread on Twitter Share thread on Reddit Share thread on Facebook Reply With Quote
Post New Thread Reply
Go Back   GoFuckYourself.com - Adult Webmaster Forum > >

Bookmarks



Advertising inquiries - marketing at gfy dot com

Contact Admin - Advertise - GFY Rules - Top

©2000-, AI Media Network Inc



Powered by vBulletin
Copyright © 2000- Jelsoft Enterprises Limited.