Hi php folks,
we need some really easy php pages.
First page: upload some pictures to a the webserver
- choose local pics,
- create destination folder,
- choose destination folder,
Second page: show pictures with checkbox to transfer to online photoservice
- choose folder,
- show all pics from folder,
- each pic with a checkbox,
- transfer choosen pics to photoservice as anonymous customer )
- transfer choosen pics to photoservice as known customer
Documention from the photoservice:
The first step is a simple session request. Later on all uploaded pictures are marked with this ID, so that all of them can be assigned to the correct customer and shopping cart and no customer can see pictures of other people. The photos are being uploaded to the inbox of the customer, so that they can be moved to an online album or ordered directly. These session IDs can be used only for the API.
To get such a session ID there are two possibilities.
a) Upload for an anonymous customer:
Here, the URL https://www.domain.com/uploadApiSessionRequest/<1>/<4> is used
b) Upload for specific customer:
Meaning of the placeholders:
<1>: Skin-ID. This value is used for the internationalisation. Language, currency, measurements are set up via this method.
<2>: User name or email address of the customer
<3>: MD5 encrypted upload pin of the customer
<4>: With this unique key the external partner is identified.
In the case of success, the answer to this request has the following format:
uploadurl=[url removed, login to view];token=def
In the case of an error, the answer includes an errorcode. Have a look at chapter 4 to see them all.
The URL given at uploadurl is used in chapter 3. for the upload. Images are sent to it.
3. Upload Images
The Upload Image request is used to send the binary photo data together with the Session-ID. The Upload Image request will be a multipart HTTP POST
(multipart/form-data). The form data may contain the following form-data elements (content-type: text/plain; charset=utf8):
Name Value token The same token as in the Session Request sessionToken “ “
In addition, the form data will contain one image file (usually content-type: image/jpeg): name="ImageData" filename="[the filename]"
In the case of a successful upload, the server should respond with something like:
HTTP/1.0 200 OK
[URL] represents a URL the customer can call to get to the photos at the photoservice.
Due to security reasons this link can be used only once, otherwise an error code will be send!
In case of a failed upload, the server responds with:
HTTP/1.0 200 OK
[errorcode] is one of the errors defined in chapter 4, error codes. If the error is a fatal error, the upload should be aborted. If the error is nonfatal (eg 'image too large'), the client should proceed with the next image.
Note: All images must be > 50kb and < 50mb.
4. Error Codes
-5 image too small
-4 image too large
-3 invalid filetype
-2 login incorrect
-1 login required
1 invalid session ID
2 user quota exceeded
3 service unavailable
4 bad request
5 unknown token
6 missing skin_id
7 invalid sessiontoken
8 link to photoservice already used
Errorcodes < 0 are nonfatal, codes > 0 are fatal.
Script will be completed by us using tokens, id's and domains.