Upload API

SHARE-ONLINE.biz UPLOAD API

To upload files with your own upload-tools or from your own website, use the following documantion to get all required information how to use it.

The API supports the upload progress from a single file or by chunk-upload with up to 8191 single parts.
A resume function is included, but this works of cause only for the chunk-upload. By using this feature you have to resume within 30min or the incompleted files will be removed.

All data has to be sent as POST-HTTP-data to port 80 of every given server/URL.

The upload is divided into two parts:

Create the upload session:

The response always includes the created sessionname and the upload URL divided by ";".

        Request to:        http://www.share-online.biz/upv3_session.php

        Required Vars:
        [username]         account username
        [password]         account password

        Response:          SESSIONNAME;UPLOADSERVER/SKRIPT.PHP

        Example:           GW63P9DEC;http://server/upv3.php
                    

Upload the data:

Getting the session is really easy, uploading without any chunk-usage, too. So we start with the single file upload ;-):

Single Upload:

        Request to:        http://server/upv3.php

        Required Vars:
        [username]         account username
        [password]         account password
        [upload_session]   upload session name from step 1
        [chunk_no]         set to "1"
        [chunk_number]     set to "1"
        [filesize]         filesize of current file in bytes
        [fn]               filedata (in HTTP forms known as type="file")
        [finalize]         set to "1"

        Response:          DOWNLOAD-URL;FILESIZE;MD5

        Example:           http://www.share-online.biz/dl/HJD74ZDM1;
                           6547231;316508123e89909723fe95945caf00a5
                           (linebreak only in example!)
                    

Chunk Upload:

This upload type is ideal for uploader tools with resume function and progress output.
The chunk-size is completely undefined, we recommend sizes between 256kb and 10mb (depending on the used line-speed). You can change to chunk-size every time you want without restarting the progress.
Please be told: the delay between each chunk may result in a lower upload-speed.

Every uploaded chunk returns a simple md5-hash as result. With this you're able to check and validate the last chunk. If the hash is different to yours you can upload this chunk again by setting the chunk_no to the desired position. This is possible for every chunk except the first one. By reuploading the first chunk again, all other parts with be resetted.

        Request to:        http://server/upv3.php

        1. Required Vars ((re)uploading chunks):

        [username]         account username
        [password]         account password
        [upload_session]   upload session name from step 1
        [chunk_no]         the current chunk number (start with "1")
        [chunk_number]     the overall count for all calculated chunks
                           (never change this during upload - max 8191)
        [filesize]         filesize of current file in bytes (overall, not chunk!)
        [fn]               filedata (of current chunk)

        Response:          MD5

        Example:           316508123e89909723fe95945caf00a5

        ---------------------------------------------------------------------

        2. Required Vars (finish the upload):

        [username]         account username
        [password]         account password
        [upload_session]   upload session name from step 1
        [chunk_no]         the current LAST chunk number
        [chunk_number]     the overall count for all calculated chunks equals [chunk_no]
        [filesize]         filesize of the resulting file (all chunks)
        [finalize]         set to "1"

        Response:          DOWNLOAD-URL;FILESIZE;MD5

        Example:           http://www.share-online.biz/dl/HJD74ZDM1;
                           6547231;316508123e89909723fe95945caf00a5
                           (linebreak only in example!)
                    

Common for both upload types:

        listed, file not allowed       is returned as response for all banned kind of data.


Annotation:

At least a small html-form with all required post-fields for single/chunk upload:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
    "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">

<head>
  <title>UPLOAD-API</title>
</head>

<body>
<form enctype="multipart/form-data" action="http://server/upv3.php" method="POST">
<table>
<tr><td>Uploadfile:</td><td><input name="fn" type="file" />
<input type="submit" value="Upload File" /></td></tr>
<tr><td>Session:</td><td><input type="text" name="upload_session" value="" /></td></tr>
<tr><td>Chunk_no:</td><td><input type="text" name="chunk_no" value="" /></td></tr>
<tr><td>Chunk_number:</td><td><input type="text" name="chunk_number" value="" /></td></tr>
<tr><td>Filesize:</td><td><input type="text" name="filesize" value="" /></td></tr>
<tr><td>Finalize:</td><td><input type="text" name="finalize" value="" /></td></tr>
<tr><td>Username</td><td><input type="text" name="username" value="" /></td></tr>
<tr><td>Password</td><td><input type="text" name="password" value="" /></td></tr>
<tr><td><input type="submit" value="Upload File" /></td></tr>
</table>
</form>

</body>

</html>
                    

Feel free to contact our support with any kind of question of suggestion.