class.upload.php is a powerful and mature PHP class to manage uploaded files, and manipulate images in many ways. The script is available under a GPL license.
If you read $_FILES['image']['name'], you have the complete filename, including the extension. You shouldn't use $_FILES anyway.
Please read the documentation. You can for instance use file_src_name to get the originale filename without the extension. Then your code can for instance be:
I rename the file to:
Output is: small_1285240138Afb060222jpg.jpg
how to change that? i just want 1 jpg.
Orginal image name: Afb060222.jpg
And how can i put this name to database?
If you read $_FILES['image']['name'], you have the complete filename, including the extension. You shouldn't use $_FILES anyway.
Please read the documentation. You can for instance use file_src_name to get the originale filename without the extension. Then your code can for instance be:
As for the database, as I said in my previous answer, it is outside of the scope of this forum.
I dont get the answer at my last question.
How can i put the new name in to the database?
I know how to put thing in the database but how do i get the final name from $foo?
Thanks.
Hint: it's all in the docs!
$MyObject = new Upload($_FILES['UPLOADFILE']);
if ($MyObject->uploaded) {
$MyObject->file_new_name_body = '{TEST-55888-49651654}';
$MyObject->file_max_size = 31048576;
$MyObject->process($pathupload);
if ($MyObject->processed) {
echo 'OK';
$MyObject->clean();
} else {
echo 'error : ' . $MyObject->error;
}
}
--------------------------------------------------
My problem is that file is saved without {} chars like this:
TEST-55888-49651654.pdf
How to fix this problem ?
Thanks in advance