Comments (2)
I have same problem, i can't download file after upload becouse there isn't extension
from php-file-upload-class.
When file is saved on disk - it's saved without extension.
If you want to preserve extension then you need to extend this class and modify way how filename is generated.
https://github.com/aivis/PHP-file-upload-class/blob/master/upload.php#L578
class MyUploadClass extends Upload
{
//....
/**
* Set unique filename
*
* @return string
*/
protected function create_new_filename() {
$filename = 'xss-safe-filename-with-extension.png';
$this->set_filename($filename);
}
But keep in mind that if you will leave extensions like ".php" and if the file permissions will not be correct - then there will be very dangerous vulnerability!
from php-file-upload-class.
Related Issues (18)
- error in uload class HOT 2
- Allowing all mime types HOT 2
- Suggest to add is_uploaded_file() check. HOT 2
- Fatal error: Class 'finfo' not found HOT 2
- hint: refactor using camelCase HOT 1
- Extra parameter on function Upload::upload HOT 1
- problem with upload array of file HOT 2
- upload two file in separate destination HOT 2
- resize to custom size HOT 1
- Please use more descriptive notes on updates
- viewing the pdf file with the new encrypted filename - Failed to load PDF document.
- .
- Multiple uploads on same page error HOT 1
- $root param method is not used in factory HOT 1
- erro in create_destionation dir already exists HOT 1
- save_file() error HOT 1
- is_writable returning NULL / false after set_destination HOT 4
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 php-file-upload-class.