Page 3 of 6
Re: New PHP Upload Process
Posted: Sun 28 May 2023 9:32 am
by Mapantz
The upload.php file may have been updated. Did you transfer it across?
Re: New PHP Upload Process
Posted: Sun 28 May 2023 9:41 am
by billy
No I didn't transfer but I see there hasn't been a change
Re: New PHP Upload Process
Posted: Sun 28 May 2023 10:01 am
by broadstairs
Just a couple of thoughts from me. There is a default in the PHP upload process where the file being sent has to be in the directory where the upload.php exist or a sub-directory. If you want to upload a file which is not in that tree you have to set a flag in upload.php. Now this is just a guess but could this be an issue? Also could there be a typo in the remote path definition so you are trying to save a file in the wrong place?
I agree turning off permanently modsecurity is a bad idea.
Stuart
Re: New PHP Upload Process
Posted: Sun 28 May 2023 10:12 am
by billy
Thanks. The uploads go to a folder nested within the folder with upload.php, and I can’t see any typos. Both of these possibilities have been unchanged since b3241.
Re: New PHP Upload Process
Posted: Mon 29 May 2023 4:52 pm
by mcrossley
I can look at adding a "content-type: text/plain" header for text files.
However, MX currently has no idea what the file content might be for binary files, but as binary files are sent as base-64 encoded text, it may be possible to use text/plain for them as well.
Re: New PHP Upload Process
Posted: Mon 29 May 2023 5:51 pm
by freddie
Or compress everything and use application/zip mime type?
Re: New PHP Upload Process
Posted: Mon 29 May 2023 6:35 pm
by mcrossley
I suspect less sites would allow zip uploads than text though?
Re: New PHP Upload Process
Posted: Mon 29 May 2023 6:53 pm
by freddie
You're probably correct. I haven't actually looked at what is implemented in the MX code, but I should really as this is my "bread and butter" (but not in php).
Re: New PHP Upload Process
Posted: Tue 30 May 2023 1:24 am
by billy
Mark, I'm happy to be a guinea pig to test if that would help
mcrossley wrote: ↑Mon 29 May 2023 4:52 pm
I can look at adding a "content-type: text/plain" header for text files.
However, MX currently has no idea what the file content might be for binary files, but as binary files are sent as base-64 encoded text, it may be possible to use text/plain for them as well.
Re: New PHP Upload Process
Posted: Wed 31 May 2023 2:13 pm
by mcrossley
OK, I'll bear that in mind - it may be a little while though as I'm off on a short break soon...
Re: New PHP Upload Process
Posted: Wed 31 May 2023 2:19 pm
by billy
No worries … enjoy your time off

Re: New PHP Upload Process
Posted: Sun 02 Jul 2023 8:26 am
by Vegit8
I am having trouble getting my moon image to update having changed to the php process. Everything else seems to work except for an oddity explained at 2. below.
1.
I have placed the upload.php file in the root of my site
www.geoffwebber.co.uk/weather
The local (at my end) path has not changed C:\CumulusMX\web\moon.png
I thought I understood the rule regarding pathing of files below the location of upload.php.
I have set the remote path for the image to /images/moon.png in the Moon Image section of /internetsettings.html
MX Diags says..
2023-07-01 15:12:00.680 PHP[Int]: Uploading Moon image file
2023-07-01 15:12:00.696 PHP[Int]: Uploading to /images/moon.png
2023-07-01 15:12:00.742 PHP[Int]: Upload to /images/moon.png: Response code = 500: InternalServerError
2023-07-01 15:12:00.742 PHP[Int]: Upload to /images/moon.png: Response text follows:
Error: Cannot create the target file /images/moon.png with this user
I'm guessing this is a permissions issue at the remote end, I don't know why, all the other uploads work fine and the above does not.
Example
2023-07-01 15:12:00.633 PHP[Int]: EOD Graph files upload starting
2023-07-01 15:12:00.633 PHP[Int]: Uploading graph data file: airquality.json
2023-07-01 15:12:00.633 PHP[Int]: Uploading to airquality.json
2023-07-01 15:12:00.680 PHP[Int]: Upload to airquality.json: Response code = 200: OK
2023-07-01 15:12:00.680 PHP[Int]: Upload to airquality.json: Response text follows:
Opening text file airquality.json for appending
Appending text file airquality.json
Writing text file airquality.json
Write complete
2.
I also get a strange situation from time to time where the Gauges page
http://geoffwebber.co.uk/weather/gauges.htm goes into offline mode (red LED) AND the data displayed is many days out of date. Recently the ticker at the top said data not received for a number of days.
Yet checking the date/time of realtimegauges.txt and realtime.txt reveals these are both as up to date as one might expect.
Clicking on the LED icon restarts the page and all is good again.
Not a major issue, just odd to explain...
Cheers
Re: New PHP Upload Process
Posted: Sun 02 Jul 2023 8:36 am
by SamiS
Vegit8 wrote: ↑Sun 02 Jul 2023 8:26 am
I have placed the upload.php file in the root of my site
www.geoffwebber.co.uk/weather
The local (at my end) path has not changed C:\CumulusMX\web\moon.png
I thought I understood the rule regarding pathing of files below the location of upload.php.
I have set the remote path for the image to /images/moon.png in the Moon Image section of /internetsettings.html
MX Diags says..
Error: Cannot create the target file /images/moon.png with this user
It seems you are trying to upload your moon image to the root of the webserver instead of subdirectory on your webfolder. If you want to have the image uploaded to weather/images/moon.png, remove the first slash prom the remote path (/images/moon.png is replaced with images/moon.png).
Re: New PHP Upload Process
Posted: Sun 02 Jul 2023 9:20 am
by Vegit8
It seems you are trying to upload your moon image to the root of the webserver instead of subdirectory on your webfolder. If you want to have the image uploaded to weather/images/moon.png, remove the first slash prom the remote path (/images/moon.png is replaced with images/moon.png).
Hah...
Thank you
Re: New PHP Upload Process
Posted: Wed 05 Jul 2023 7:57 am
by Vegit8
any ideas folks?
2.
I also get a strange situation from time to time where the Gauges page
http://geoffwebber.co.uk/weather/gauges.htm goes into offline mode (red LED) AND the data displayed is many days out of date. Recently the ticker at the top said data not received for a number of days.
Yet checking the date/time of realtimegauges.txt and realtime.txt reveals these are both as up to date as one might expect.
Clicking on the LED icon restarts the page and all is good again.
NOTE: This happens even when opening the page for the first time of the day (not every day however).
Not a major issue, just odd to explain...
