Printable Version of Topic

Click here to view this topic in its original format

HTMLHelp Forums _ Web Site Functionality _ Html-Post Facebook

Posted by: Arimle Nov 25 2020, 03:32 AM

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

Posted by: pandy Nov 25 2020, 03:37 AM

I don't understand. What download button? What are you trying to do?

Regarding the PHP script, I doubt very much that you can use PHP or any server side language at all at Facebook. Can you even use HTML? I don't think so.

Posted by: Arimle Nov 25 2020, 03:50 AM

QUOTE(pandy @ Nov 25 2020, 03:37 AM) *

I don't understand. What download button? What are you trying to do?

Regarding the PHP script, I doubt very much that you can use PHP or any server side language at all at Facebook. Can you even use HTML? I don't think so.


I want to upload a selected file to Facebook and share it.
I can use HTML. But can not use PHP.

Posted by: pandy Nov 25 2020, 04:59 AM

OK. I didn't know you were allowed to use *anything* there. But if FB allows file sharing, don't they already have a function for that?

Sorry, but I don't use FB, so I'm afraid I can't help very much.

Posted by: Arimle Nov 25 2020, 05:20 AM

QUOTE(pandy @ Nov 25 2020, 04:59 AM) *

OK. I didn't know you were allowed to use *anything* there. But if FB allows file sharing, don't they already have a function for that?

Sorry, but I don't use FB, so I'm afraid I can't help very much.


How do you think this can be done on Instagram?

Posted by: pandy Nov 25 2020, 05:21 AM

No idea. I wouldn't have thought it could be done on any of those services. I don't use insta either.

Posted by: TitianAnna Jun 2 2022, 08:55 PM

I have posted personal photos that I have edited on instagram and other social networking sites but the likes are negligible even though my friends and followers are quite a lot. Please share

Posted by: pandy Jun 2 2022, 10:36 PM

Tough luck.

Posted by: TitianAnna Jun 4 2022, 04:21 AM

I came back here because Followergir APK https://techzapk.com/followergir.htm is a useful use for instagram

Posted by: pandy Jun 4 2022, 05:47 AM

So that solved your problem?

Powered by Invision Power Board (http://www.invisionboard.com)
© Invision Power Services (http://www.invisionpower.com)