Update on Project – DirectLinkHosting

This is probably an extremely fast update but i did spend a lot of the night on this new project which is now up and running. As promised, the PHP behind the website is now available.
The function:
upload_GS($sourcefile, $targetfile, $secret_key, $authkey)
$sourcefile must be the REAL and long path to the file you want to upload.
$targetfile must be the path at which you want to upload the file.
$secret_key must be the secret to the access key (Google Storage Developers Section)
$authkey must be the access key (Google Storage Developers Section)
In practice:
The following script would upload the file (providing it exists) to the Google Storage Bucket. You can implement this next code in an IF statement, i will explain more about this later.

upload_GS(“/home/username/public_html/mymp3.mp3”, “/mymp3.mp3”, “SECRET”, “ACCESS_KEY”)
You will need to edit the PHP code and change where its actually uploading to because at the moment its set to upload to my storage bucket. You can very easily do this by editing all occurrences of “storage.directlinkhosting.cz.cc” with “commondatastorage.googleapis.com/BUCKETNAME” EXCEPT for the HOST header. This can be changed to “commondatastorage.googleapis.com”.

Embedded into a IF statement:
Seeing as the function that i created returns either TRUE or FALSE on success or failure, it is pretty simple to integrate into an IF statement.

if(!upload_GS(“/home/username/public_html/mymp3.mp3”, “/mymp3.mp3”, “SECRET”, “ACCESS_KEY”)) {
$error = “Critical Error!”;
} else {
// Insert into database? Do an action? Up to you!
}

Continue reading “Update on Project – DirectLinkHosting”

Working on a new project!

I know its been a while since my last post (blog, tweet? no idea what you call it) but i have been really busy with HostWoot and college work and have had no time in between.

In the little time i had available i decided to write up a “quick” script which PUT files to Google Storage. However, the “quick” script ended up taking me 10 hours because of a tiny error i overlooked.

My new project will be called “Direct Link Hosting” and well.. the title pretty much says everything. It is basically a free direct link hosting website where everyday users can upload literally nearly any file which is under 15MB and have a direct link to provide their friends or even hotlink. Originally it was only a test to see if i could make such a PHP script but i then asked myself, would it not be useful if i had a site where it was actually in use? Maybe it could become one of my projects?

Continue reading “Working on a new project!”