Get link after upload file on mediafire api

2.8k Views Asked by At

Hi, I am trying to get file link after upload afile using mediafire api

$appId = "";
$apiKey = "";
$email = "";
$password = "";

include("../mflib.php");

$mflib = new mflib($appId, $apiKey);
$mflib->email = $email;
$mflib->password = $password;


$sessionToken = $mflib->userGetSessionToken();
$uploadKey = $mflib->fileUpload($sessionToken, "500px-PHP.png");

$mp3=$mflib->fileGetLinks($quickkey,'direct_download',$sessionToken);

But it gives me the following error:

Error - Get file links : "Invalid parameter 'quickkey' specified" (0)

The file is already uploaded but I can't get the link I trying to get the $quickkey. What is the right way to get it?

2

There are 2 best solutions below

0
On
 $data=$mflib->filePollUpload($sessionToken, $uploadKey);
                    $quickkey=$data['quickkey'];
     $mp3=$mflib->fileGetLinks($quickkey,'direct_download',$sessionToken);
**You need to provide $quickkey but you didn't declare this veriable.** 
0
On

Once you completed the upload, use the key from the response (response.doupload.key) to poll the upload. it is known as the upload_key.

The whole idea is to see if the upload has truly been completed (which should produce a quickkey). When you poll the upload (intermittently , say a couple of secs) using the upload_key, check that the status(response.doupload.status==99) then get the quickkey (response.doupload.quickkey)

This is the quickkey you use in your getting the link

pls see links:

https://www.mediafire.com/developers/upload.php#poll_upload

https://www.mediafire.com/developers/download.php#direct_download_link