Mediafire PHP file uploading and get link example
In this post we will give you information about Mediafire PHP file uploading and get link example. Hear we will give you detail about Mediafire PHP file uploading and get link exampleAnd how to use it also give you demo for it if it is necessary.
When i was working on my project i need to use mediafire API for uploading image and video, I did see this API is little hard to undestand but it is pretty easy to use also. In this post i want to share example how to get link of uploaded image or video. If you are new and you need to example for uploading example then it is very simple example that way you can undestand very well. I also see other example from google search but that was very difficult to undestand and use too.
So ,first you should need to download mflib.php file for Mediafire API. so if you dan’t have this file then you can downlaod from here: mflib.php. Now you have to just create one file in your root directory and put bellow code:
index.php
<?php
error_reporting(E_ALL);
ini_set('display_errors', 1);
require_once("../mflib.php");
$appId = "";
$apiKey = "";
$email = "";
$password = "";
?>
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
<title>PHP - MediaFire API Library - File Uploading With Get Link</title>
</head>
<body>
<form method="post" enctype="multipart/form-data" action="">
<p>Upload a file:</p>
<label title="Choose a Local File to a MediaFire account" for="file">File:</label>
<input type="file" id="file" name="file" size="30" />
<div style="clear:left;display:block;" id="dvFile"></div>
<input type="submit" id="upload" name="upload" value="Upload" />
</form>
</body>
</html>
<?php
if (isset($_POST['upload'])) {
$mflib = new mflib($appId, $apiKey);
$mflib->email = $email;
$mflib->password = $password;
$token = $mflib->userGetSessionToken(null);
$uploadkey = $mflib->fileUpload($token, $_FILES["file"]["tmp_name"],"myfiles",$_FILES["file"]["name"]);
$fileDetails = $mflib->filePollUpload($token, $uploadkey);
$link = $mflib->fileGetLinks($fileDetails['quickkey'], "direct_download", $token);
print_r($link);
}
?>
Hope this code and post will helped you for implement Mediafire PHP file uploading and get link example. if you need any help or any feedback give it in comment section or you have good idea about this post you can give it comment section. Your comment will help us for help you more and improve us. we will give you this type of more interesting post in featured also so, For more interesting post and code Keep reading our blogs