Fatal error: Class 'Upload' not found in

See all posts Reply

Fatal error: Class 'Upload' not found in new!
by Andres Sepcid, 4 years, 7 months ago
Hello, I want to take the opportunity to thank Verot for such an excellent script to upload files.

The reason for my message is because I downloaded the latest version available and changed the old file class.upload.php to the new one. At the time of uploading an image I got the error:
Fatal error: Class 'Upload' not found in...

I thank who can explain to me the reason why my PHP script does not recognize the call to the class when calling it:
$image = new Upload ($_FILES ["img"]);

With the old file it works without problems, but if I call the new file it immediately generates an error.

I hope someone can give me an answer to solve this problem.

Thank you.Reply
Re: Fatal error: Class 'Upload' not found in new!
by Vardan Grigoryan, 4 years, 7 months ago
In the php file where you have added
$image = new Upload ($_FILES ["img"]);

Go to top of the page and add the name space as the first line
namespace Verot\Upload;
Reply
Re: Fatal error: Class 'Upload' not found in new!
by Andres Sepcid, 4 years, 7 months ago
Vardan, thanks for your reply. Indeed, before consulting here I added that line at the beginning of the file and after calling the class. However nothing happened. I must point out that I do not use Composer or Laravel, I program in pure PHP without frameworks. In my case, what should I do to enable that option correctly? A cordial greeting.Reply
Re: Fatal error: Class 'Upload' not found in new!
by Andres Sepcid, 4 years, 5 months ago
It worked for me! Thanks for the help. Today with more time and more calm I followed the steps that you indicated to me to put "namespace Verot \ Upload;" at the beginning of the file that executes the image upload and it worked correctly. I can finally generate WEBP files for my web pages.Reply
Re: Fatal error: Class 'Upload' not found in new!
by Martin Galinger, 4 years, 7 months ago
same problem here, any help please.. Thanks in advanceReply
Re: Fatal error: Class 'Upload' not found in new!
by colin, 4 years, 7 months ago
Re: Fatal error: Class 'Upload' not found in new!
by sarf, 3 years, 3 months ago
$image = new \Verot\Upload\Upload($_FILES['image_field']);Reply
Re: Fatal error: Class 'Upload' not found in new!
by kontakrep, 3 years, 3 months ago
Fatal error: Uncaught Error: Class 'Upload' not found in

works on another project. but in this project it gives an error. The namespace also gives an error. How do I add where.Reply