![]() |
File upload with HtmlWebRequest on server [works on localhost] - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: File upload with HtmlWebRequest on server [works on localhost] (/showthread.php?tid=79457) |
File upload with HtmlWebRequest on server [works on localhost] - MBVape64 - 06-18-2021 Hello, I have a site where a user records a video of himself, which is directly captured from the camerafeed and then sent via xhr to the backend to be saved. This works perfectly on localhost (Xampp on windows), but it does not work when I run the exact same code on the server. XHR code: Code: media_recorder.addEventListener('stop', function() { Upload code: PHP Code: function save_video() Error: ![]() PHP Code: On my development PC (Windows 10, with Xampp), the code works fine. RE: File upload with HtmlWebRequest on server [works on localhost] - InsiteFX - 06-18-2021 The error is telling you where the problem is, its not getting the file path check your path. RE: File upload with HtmlWebRequest on server [works on localhost] - MBVape64 - 06-19-2021 Hello, Thank you for your reply. Isn't it saying that the $video object is null though? As in, something goes wrong with the form on the xhr side? The error log shows an invalid file error... It does work on localhost, so it seems to be an enviroment problem? RE: File upload with HtmlWebRequest on server [works on localhost] - MGatner - 06-19-2021 Yes, $video is null because the file upload failed. If it is working in one environment and not another most likely it is an environment restriction - check your max file size upload, upload extension restrictions, memory limit, etc. You should also be able to find the root error in the PHP error logs. RE: File upload with HtmlWebRequest on server [works on localhost] - MGatner - 06-19-2021 Ooo check that your writable folder is actually writable! Should have put that first. RE: File upload with HtmlWebRequest on server [works on localhost] - MBVape64 - 06-19-2021 Wasnt the issue. It was enviromental indeed, php.ini's max upload size was too low for the file I was trying to write. Thanks for your help! RE: File upload with HtmlWebRequest on server [works on localhost] - paliz - 06-19-2021 Put your uploads files in public/upload You can not read file in writable folder RE: File upload with HtmlWebRequest on server [works on localhost] - ikesela - 06-19-2021 normally on folder permission issue RE: File upload with HtmlWebRequest on server [works on localhost] - InsiteFX - 06-19-2021 max_upload_size and max_post_size should both be the same value. |