givanz / Vvveb

Powerful and easy to use cms to build websites, blogs or ecommerce stores.
https://www.vvveb.com
GNU Affero General Public License v3.0
288 stars 62 forks source link

Upload error on XAMPP + SQLite #162

Open GianlucaLocri opened 1 month ago

GianlucaLocri commented 1 month ago

Hi, new user here! First of all thanks for this AMAZING work! I'm trying to design my new site and before going live I've set up an xampp environment with sqlite as DB. All is working correctly but as soon as I try to upload an image to the media folder I receive this message: "Error Error uploading! "

Can you help me to sort this out?

from xampp console: Windows Version: Enterprise 64-bit XAMPP Version: 8.2.12 Control Panel Version: 3.3.0

browser: 128.0 (64 bit) but tried also on Edge, same result.

Thanks!

givanz commented 1 month ago

Hi

Thank you.

A common upload issue with XAMPP is a small 2MB limit for upload_max_filesize.

You can check the current value of Upload max filesize in admin > tools > system info https://demo.vvveb.com/admin/index.php?module=tools/systeminfo

To test if this is the cause try to upload a small image and see if it works.

You can increase upload_max_filesize by editing xampp's php.ini

Locate the Xampp folder and then open it. Inside the XAMPP folder, search for the php folder and then double click on it. On the respective folder, search for the php.ini files. If you could find the file with the related name then open it.

https://www.thewindowsclub.com/increase-phpmyadmin-upload-size-on-xampp

You can also check php error log if there are any errors related to upload in admin > tools > error log https://demo.vvveb.com/admin/index.php?module=tools/errorlog

GianlucaLocri commented 1 month ago

Wow you are fast! I've checked and my default setting for upload_max_filesize is 40M, also I was trying with very small files. admin > tools > error log returned a PHP error log not readable, make sure that your log is properly configured and that is readable.

But I checked the log in \xampp\apache\logs\error.log and I found this two messages: PHP Warning: move_uploaded_file(C:\\xampp\\htdocs\\public\\media\\\\public\\media\\hero.png): Failed to open stream: No such file or directory in C:\\xampp\\htdocs\\admin\\controller\\media\\media.php on line 133, referer: http://localhost/admin//index.php?module=editor/editor&url=/&template=index.html PHP Warning: move_uploaded_file(): Unable to move "C:\\xampp\\tmp\\php29CA.tmp" to "C:\\xampp\\htdocs\\public\\media\\\\public\\media\\hero.png" in C:\\xampp\\htdocs\\admin\\controller\\media\\media.php on line 133, referer: http://localhost/admin//index.php?module=editor/editor&url=/&template=index.html

givanz commented 1 month ago

Thanks for pasting the error message.

I found some media code that didn't work with windows path separator.

I changed the code to work on windows also, please redownload latest.zip and update admin/controller/media/media.php.

GianlucaLocri commented 1 month ago

Thanks again for the quick support, but unfortuntely I've updated the file, restarted xampp, cleared firefox cache, etc, but I've got the same error... I've also tried to clear the vvveb cache and just to be sure I've verified that I'm using the corrected file (I see a single modification at line 72 that now is $path = preg_replace('@^[\/]public[\/]media|^[\/]media|^[\/]public@', '', $path);)

givanz commented 1 month ago

Only line 72 was changed to work for windows path format. I think it's still wrong, can you please change line 72 to

$path      = preg_replace('@^[\\\/]public[\\\/]media|^[\\\/]media|^[\\\/]public@', '', $path);

If it still doesn't work please check error.log and see if it's the same error message or something different.

GianlucaLocri commented 1 month ago

YEAH That's it! Now it works flawlessly! Thanks!