The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

> Html-Post Facebook, Html-Post Facebook
Arimle
post Nov 25 2020, 03:32 AM
Post #1





Group: Members
Posts: 3
Joined: 25-November 20
Member No.: 27,653



I have an html file that selects a file from the user's computer
CODE

<html>
    <body>
    <form enctype="multipart/form-data" action="http://localhost/uploader/upload.php" method="POST">
    Please choose a photo:
    <input name="source" type="file"><br/><br/>
    Say something about this photo:
    <input name="message" type="text" value=""><br/><br/>
    <input type="submit" value="Upload"/><br/>
    </form>
    </body>  
</html>


When I click the download button, I need to upload this file to Facebook and share this file.
On the Internet I found the following code. I'm very little familiar with PHP, but I think this code is closer to my task.
CODE

<?php
//upload.php
if(isset($_FILES['photo']) && isset($_POST['message'])){

    $uploadfile = './uploads/'.basename($_FILES['photo']['name']);

    $iStats=getimagesize($_FILES['photo']['tmp_name']);

    if (isset($iStats['mime']) && $iStats[0]>0) {
        move_uploaded_file($_FILES['photo']['tmp_name'], $uploadfile);
        include_once 'fbmain.php';
        try{
            $uid = $facebook->getUser();
            $me = $facebook->api('/me');
            $token = $session['access_token'];//here I get the token from the $session array
            $album_id = '2179901265385';//MY ALBUM ID
            $facebook->setFileUploadSupport(true);
            $args = array('message' => $_POST['message']);
            $args['image'] = '@' . realpath($uploadfile);

            $data = $facebook->api('/'. $album_id . '/photos?access_token='. $token, 'post', $args);

        } catch(FacebookApiException $e){
            echo "Error:" .$e;
        }
        unlink($uploadfile);
        echo "Success!\n";
    } else {
        echo "Wrong file type!\n";
    }
}

?>

Please help me, what needs to be changed in the code in order to transfer the selected file to Facebook and share this file?



Attached File(s)
Attached File  FB1.HTML ( 1.49k ) Number of downloads: 496
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
 
Reply to this topicStart new topic
Replies
TitianAnna
post Jun 4 2022, 04:21 AM
Post #2





Group: Members
Posts: 2
Joined: 2-June 22
Member No.: 28,373



I came back here because Followergir APK https://techzapk.com/followergir.htm is a useful use for instagram
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jun 4 2022, 05:47 AM
Post #3


🌟Computer says no🌟
********

Group: WDG Moderators
Posts: 20,733
Joined: 9-August 06
Member No.: 6



So that solved your problem?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post

Posts in this topic


Reply to this topicStart new topic
3 User(s) are reading this topic (3 Guests and 0 Anonymous Users)
0 Members:

 



- Lo-Fi Version Time is now: 27th April 2024 - 05:44 AM