aivis / php-file-upload-class Goto Github PK
View Code? Open in Web Editor NEWSimple file validation & upload class
Simple file validation & upload class
PHP Fatal error: Class 'finfo' not found in upload.php on line 147
how can i read this new filename back to the normal viewing pdf
'filename' => string '091755cc57ee634186cd2655c3a0ec990c36f9161322940586' (length=50)
thank you!
I tried from test.php but its giving this error
instead of underline _ my_function()
hi
i want upload array like this
`Array
(
[0] => Array
(
[name] => 7feb99f684d5d44eceb8084247188bc5.jpg
[type] => image/jpeg
[tmp_name] => C:\wamp64\tmp\php2506.tmp
[error] => 0
[size] => 276309
)
[1] => Array
(
[name] => 6ee8368da2517a4b9802506695231697.jpg
[type] => image/jpeg
[tmp_name] => C:\wamp64\tmp\php2507.tmp
[error] => 0
[size] => 268148
)
)
`
what to do?
i have an array
array 'first=> array name =>'a' ..... sec => array name =>'b''
i want use Upload class in another class and upload first to first/path and sec to sec/path
please help .how?
thanks
"Update upload.php" is not a useful record of what was changed in the file. Please use more descriptive notes. :-)
full_path key not use $this->root.
Fix:
$this->file['full_path'] = $this->root . $this->destination . $this->filename;
at Upload::factory() $root param not exists.
That function recieves the $filename
parameter and does nothing with it.
After the file uploaded, there is no extension.
So what's going with this file when user download this file?
i want to resize to custom size when image upload.
how?
Need add, to create_destination method, a check for the existence of a directory.
For example:
if (is_dir($this->root . $this->destination)){
return true;
}
Notice: Constant ROOT already defined in C:\wamp\www\document-signature\libs\upload.php on line 137
Solution:
if (!defined('ROOT'))
define('ROOT', $_SERVER['DOCUMENT_ROOT'] . DIRECTORY_SEPARATOR);
this is a security issue, it's better to do this.
http://php.net/manual/en/function.is-uploaded-file.php
Firstly i would like to say good work, this is decent script.
I was getting:
Warning: mkdir(): File exists in <dir>\upload.php on line 573
when trying to use a pre-created directory, or uploading more than once to same directory after creation.
I searched the class and found set_destination()
and sub-sequentially is_writable()
was being called on a relative path and returning NULL, I had to change:
ln. 558
protected function destination_exist() {
return is_writable($this->destination);
}
To this:
protected function destination_exist() {
return is_writable($this->root . $this->destination);
}
To get it to check the directory correctly
If i want to allow all the mime types, can i just don't put the line that checks the mime types?
Like this:
//set allowed mime types - delete this line for allow all mime types //$upload->set_allowed_mime_types(array('application/pdf'));
Or i need to allow a * in instead of puting the mime type?
Like this:
//set allowed mime types - puting a "*" instead of a mime type $upload->set_allowed_mime_types(array('application/ * '));
Thanks for the awesome upload class !
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.