123
-=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- (c) WidthPadding Industries 1987 0|524|0 -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=- -=+=-
Socoder -> Web Development -> Uploading From PHP

Thu, 25 Mar 2021, 05:56
Jayenkai

Uploading From PHP


*sigh*
I'm really struggling to find the answer with Google, today.
Hate it when the thing I'm looking for has a VERY similar set of answers, which are in fact the exact opposite of the thing I'm looking for, but that always show up in the results.

Here's what I've got.
1. Script runs on Mac, scans folder, finds any new files that aren't already on the server.
2. ?
3. Script on server receives POST method based uploaded file, and happily stores the file on the server.

In step 2, I need to..
A. Create a POST request.
B. Add the File and its contents to the POST request.
C. Send the POST request to the specific url.

Anyone?!

-=-=-
''Load, Next List!''
Thu, 25 Mar 2021, 06:27
cyangames
Is this solely for one directory or are you looking at a full computer backup?

-=-=-
Web / Game Dev, occasionally finishes off coding games also!
Thu, 25 Mar 2021, 06:39
Jayenkai
Game Assets on the Mac are now bundled into a neat folder layout.
Game Number - GameTitle/ScreenshotA.png, ScreenshotB.png, ScreenshotC.png, Icon.png, etc

BUT.. On the server, they're all the fuck over the place!!
Decades of development has lead to a crazy array of folder paths and such, but I've tried over the years to keep files where they originally were, so that a link to a game from 2005 still links to the game from 2005.
As such, even though everything's neat and tidy on the Mac, the server side is quite the opposite.
Each entry in the SQL database includes a path to the assets for that particular game, and it mostly works well enough.

Back on the Mac, the single Asset folder has a new Asset Generator script.
The Asset Generator flicks through all the folders, tell me what assets are missing (eg, if an older game only has 2 screenshot, whilst the site now handles 4 screenshots per game, or perhaps the game doesn't include a new CoverArt.png)
It'll generate logo.png's using standard fonts.
It'll take small icon_64.png's and resize them to icon_512.png.
It'll generate Steam icons using a screenshot and logo.
It's quite happy to do all of this, but then the results are simply sitting on the Mac.

My task is to complete the set of assets so that every game has the same set of 4 screenshots, a logo, an icon, a Cover Art and a Steam Icon.
The site then handles the rest..

I need to upload any new image to the server, have it put the file in the right place..


.. However..
As I'm typing this, with your thought in mind, I'm now thinking that I could simply copy the file on the hard drive, and then later on do an upload to the server to catch up any new files..
.. Yeah, actually, that would probably be much easier (and more secure) than trying to upload everything directly via PHP.
Thanks for the mind-jolt

-=-=-
''Load, Next List!''
Thu, 25 Mar 2021, 07:14
cyangames
No worries, it reminded me of some code I wrote to make offline backups from remote webservers for which applies kinda the same principle.

Sounds like you've got a much nicer plan there

-=-=-
Web / Game Dev, occasionally finishes off coding games also!
Thu, 25 Mar 2021, 07:20
Jayenkai
OK, that's working.
Thanks for the advice, Rychan

Now all I need to do is take over 2000 screenshots, generate Cover Art, Logos and Icons for about 400 old games, and Bob's your uncle!

-=-=-
''Load, Next List!''
Thu, 25 Mar 2021, 09:30
cyangames
Now, that sounds like a job for PHP, eep!
Thu, 25 Mar 2021, 09:56
Jayenkai
I drew 4 new coverart images, today..
Four..
That's the immediate list down to 687...

The immediate list is everything from SmileBASIC, Shoebox, Browsercade and Foldapuz.
Everything recent, from the past few years.

Everything before that is waiting, because it's missing a ton more stuff.

Now games like this have lovely coverart!

-=-=-
''Load, Next List!''