Comments (8)
I don't understand what you mean.
This:
$var = 'test';
$handle->file_new_name_body = "img_{$var}";
Is the same as this:
$handle->file_new_name_body = "img_test";
So the fact that there is a variable interpolation doesn't matter.
And then, if you have:
$handle->file_new_name_body = "img_test";
You get as images:
img_test.jpg
img_test_1.jpg
img_test_2.jpg...
Or, if you have:
$handle->file_new_name_body = "img_test_";
You get as images:
img_test_.jpg
img_test__1.jpg
img_test__2.jpg...
I don't see where the problem is...
from class.upload.php.
I never get an upload named:
img_test.jpg
It's always img_test_1.jpg
then subsequent uploads are:
img_test_2.jpg
img_test_3.jpg
img_test_4.jpg
and so on.
Additionally, if I set
$handle->file_auto_rename = false;
Then nothing is saved at all.
Thanks for an awesome class by the way, and all your hard work!
from class.upload.php.
Can you copy here the logs produced by the class for each of your attempts you are describing above?
from class.upload.php.
I just got this to work by removing the call to $handle->clean();
:
$handle = new upload( $filePath );
if ( $handle->uploaded ) {
// main image
$handle->file_new_name_body = (string) $pathMain;
$handle->allowed = array('image/*');
$handle->image_resize = true;
$handle->image_no_enlarging = true;
$handle->jpeg_quality = 50;
$handle->image_x = 512;
$handle->image_y = 288;
$handle->file_overwrite = true;
$handle->file_auto_rename = false;
$handle->process( $imgPath );
if ( !$handle->processed ) {
$errors[] = $handle->error;
}
// thumb
$handle->file_new_name_body = (string) $pathThumb;
$handle->allowed = array('image/*');
$handle->image_resize = true;
$handle->image_no_enlarging = true;
$handle->jpeg_quality = 50;
$handle->image_x = 192;
$handle->image_y = 108;
$handle->file_overwrite = true;
$handle->file_auto_rename = false;
$handle->process( $imgPath );
if ( !$handle->processed ) {
$errors[] = $handle->error;
}
$handle->clean(); // <-- removed this and filenames are working now
}
from class.upload.php.
This shouldn't have an effect. Can you copy here the logs produced by the class, with and without $handle->clean()
?
from class.upload.php.
Can you tell me how to get the log contents? I can't see anything in the docs about logging? Thanks.
from class.upload.php.
Just add this at the end of your code: echo $handle->log;
from class.upload.php.
I got the same problem. $handle-> clean(); solved the problem
from class.upload.php.
Related Issues (20)
- It seems the latest version still not work with gif file HOT 2
- PHP 8.1 HOT 6
- "Failed to load magic database" HOT 7
- Notice on imagecolorat() HOT 3
- can support text shadow? HOT 1
- Cyrillic symbols encoding HOT 4
- Text crop HOT 4
- Allowed video/* Doesn't Include MP4 HOT 1
- Bmp format conversion error HOT 3
- Feature: Repeats Watermark HOT 2
- Feature: add support for avif format HOT 3
- Suggestion: filter the content of svg HOT 2
- Multipart upload HOT 1
- Deprecation php8.2 HOT 3
- Composer is not up2date HOT 1
- view image when selected HOT 1
- PHP 8.2 Dynamic property is deprecated
- Security vulnerability disclosure HOT 2
- Found 1 security vulnerability advisory when run Composer audit HOT 2
- Fix security vulnerability related to XSS attacks via uploaded files HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from class.upload.php.