GoFuckYourself.com - Adult Webmaster Forum

GoFuckYourself.com - Adult Webmaster Forum (https://gfy.com/index.php)
-   Fucking Around & Business Discussion (https://gfy.com/forumdisplay.php?f=26)
-   -   Need php help, quick question ;) (https://gfy.com/showthread.php?t=754038)

Pipecrew 07-23-2007 04:56 PM

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!";
}

Masterchief 07-23-2007 04:57 PM

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

the bold part is where you would place the name

StuartD 07-23-2007 04:58 PM

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.

Pipecrew 07-23-2007 05:04 PM

Quote:

Originally Posted by StuartD (Post 12804527)
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?

SomeCreep 07-23-2007 05:06 PM

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?

Jman 07-23-2007 05:08 PM

Yo Pipecrew can you hit me up on ICQ when you have a second please. 124588247

StuartD 07-23-2007 05:08 PM

Quote:

Originally Posted by Pipecrew (Post 12804554)
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.

Pipecrew 07-23-2007 05:12 PM

Quote:

Originally Posted by SomeCreep (Post 12804565)
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.

SomeCreep 07-23-2007 05:15 PM

Quote:

Originally Posted by Pipecrew (Post 12804595)
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.

Pipecrew 07-23-2007 05:16 PM

Quote:

Originally Posted by StuartD (Post 12804575)
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!

StuartD 07-23-2007 05:48 PM

Quote:

Originally Posted by Pipecrew (Post 12804616)
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. :thumbsup

WiredGuy 07-23-2007 06:00 PM

I didn't know you were a coder :)
WG


All times are GMT -7. The time now is 03:51 AM.

Powered by vBulletin® Version 3.8.8
Copyright ©2000 - 2025, vBulletin Solutions, Inc.
©2000-, AI Media Network Inc123