A question
Moderator: Staff
- pawelabrams
- Posts: 3207
- Joined: Sun Jun 24, 2007 8:14 pm
- Location: Novograd, Interland
- Contact:
A question
When I upload one version of culture file and then I want to update it, what should I do?
Pavel' Abramovic:, the President of Interland
IRL just a random guy from Poland. Still learning English.
IRL just a random guy from Poland. Still learning English.
- dr-spangle
- Technical Advisor
- Posts: 13072
- Joined: Wed May 30, 2007 12:20 pm
- Contact:
- pawelabrams
- Posts: 3207
- Joined: Sun Jun 24, 2007 8:14 pm
- Location: Novograd, Interland
- Contact:
emmm... and flamewars? one person uploads right file and then a troll goes and overwrites it by empty file xP passwords? User-system on forumlist?
EDIT: Or maybe versioning system? old files saved as /number/old/originalname.version(one-number, like 1,2,3,4,5 etc).ext ?
EDIT: Or maybe versioning system? old files saved as /number/old/originalname.version(one-number, like 1,2,3,4,5 etc).ext ?
Pavel' Abramovic:, the President of Interland
IRL just a random guy from Poland. Still learning English.
IRL just a random guy from Poland. Still learning English.
- dr-spangle
- Technical Advisor
- Posts: 13072
- Joined: Wed May 30, 2007 12:20 pm
- Contact:
- pawelabrams
- Posts: 3207
- Joined: Sun Jun 24, 2007 8:14 pm
- Location: Novograd, Interland
- Contact:
Yay, I helped spangle with the forumlist! and MAS!
by the way:
link to MAS on Main Page doesn't work (yet?)
by the way:
link to MAS on Main Page doesn't work (yet?)
Pavel' Abramovic:, the President of Interland
IRL just a random guy from Poland. Still learning English.
IRL just a random guy from Poland. Still learning English.
- dr-spangle
- Technical Advisor
- Posts: 13072
- Joined: Wed May 30, 2007 12:20 pm
- Contact:
MAS site is still in production
I have worked out how the filesystem will be and i have the stylesheet complete, the header part of the page is almost complete and then i have a lot of work left
version numbers seem difficult because i'ld have to explode the filename at the . and then check for number and add one
I could do it but I'm working on MAS site...
A lot of work actually need to be done on cultureUpload but it's not much and not too much work
EDIT: Got it!
How about it explodes by the . then adds the first 5 chars of the MD5 of the time to the file name! simple.
I have worked out how the filesystem will be and i have the stylesheet complete, the header part of the page is almost complete and then i have a lot of work left
version numbers seem difficult because i'ld have to explode the filename at the . and then check for number and add one
I could do it but I'm working on MAS site...
A lot of work actually need to be done on cultureUpload but it's not much and not too much work
EDIT: Got it!
How about it explodes by the . then adds the first 5 chars of the MD5 of the time to the file name! simple.
Last edited by dr-spangle on Fri Apr 11, 2008 5:57 pm, edited 1 time in total.
- dr-spangle
- Technical Advisor
- Posts: 13072
- Joined: Wed May 30, 2007 12:20 pm
- Contact:
- pawelabrams
- Posts: 3207
- Joined: Sun Jun 24, 2007 8:14 pm
- Location: Novograd, Interland
- Contact:
you don't need it....
try this?:
and then write file with name "$oldname.$i.$oldextension"
try this?:
Code: Select all
$i=1;
while (file_exists('/'.$idnum.'/old/'.$oldname.'.'.$i.'.'.$oldextension)) {
$i++;
}
Pavel' Abramovic:, the President of Interland
IRL just a random guy from Poland. Still learning English.
IRL just a random guy from Poland. Still learning English.
- dr-spangle
- Technical Advisor
- Posts: 13072
- Joined: Wed May 30, 2007 12:20 pm
- Contact:
I'm all up for open sauce (although it can cause it to go off a bit more quickly)
here's the upload_culture.php file:
I use $_FILES['file']['name'] as the filename so i would have to explode it at the dot to add anything to the filename
EDIT: Yeah the code is uber-messy and I never use messages
one day i'll clean that one up, the rest are rather clean already
here's the upload_culture.php file:
Code: Select all
Code removed now that it ha been solved
EDIT: Yeah the code is uber-messy and I never use messages
one day i'll clean that one up, the rest are rather clean already
Last edited by dr-spangle on Sat Apr 12, 2008 12:06 am, edited 1 time in total.
- pawelabrams
- Posts: 3207
- Joined: Sun Jun 24, 2007 8:14 pm
- Location: Novograd, Interland
- Contact:
Use that:
Code: Select all
$toexplode=basename($_FILES['file']['name']);
//THERE SHOULD BE CODE REPLACING [b]ONLY[/b] LAST DOT!!! (It can be
//made even with substr)
$afterexplode=explode($toexplode, '#');
$i=1;
while (file_exists('/'.$folder_num.'/old/'.$afterexplode[0].'.'.$i.'.'.$afterexplode[1])) {
$i++;
}
Pavel' Abramovic:, the President of Interland
IRL just a random guy from Poland. Still learning English.
IRL just a random guy from Poland. Still learning English.
- dr-spangle
- Technical Advisor
- Posts: 13072
- Joined: Wed May 30, 2007 12:20 pm
- Contact:
- pawelabrams
- Posts: 3207
- Joined: Sun Jun 24, 2007 8:14 pm
- Location: Novograd, Interland
- Contact:
try to make it easier without using db... Hey, you have db... so you can make table "files" with column "last_version"... I had a query for that to make "last_version" increasing by one without using php inside sql instructions...
Pavel' Abramovic:, the President of Interland
IRL just a random guy from Poland. Still learning English.
IRL just a random guy from Poland. Still learning English.