The Web Design Group

... Making the Web accessible to all.

Welcome Guest ( Log In | Register )

 
Reply to this topicStart new topic
> 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: 483
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Nov 25 2020, 03:37 AM
Post #2


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

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



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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Arimle
post Nov 25 2020, 03:50 AM
Post #3





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



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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Nov 25 2020, 04:59 AM
Post #4


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

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



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.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
Arimle
post Nov 25 2020, 05:20 AM
Post #5





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



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?
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Nov 25 2020, 05:21 AM
Post #6


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

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



No idea. I wouldn't have thought it could be done on any of those services. I don't use insta either.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
TitianAnna
post Jun 2 2022, 08:55 PM
Post #7





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



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
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
pandy
post Jun 2 2022, 10:36 PM
Post #8


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

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



Tough luck.
User is offlinePM
Go to the top of the page
Toggle Multi-post QuotingQuote Post
TitianAnna
post Jun 4 2022, 04:21 AM
Post #9





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 #10


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

Group: WDG Moderators
Posts: 20,716
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

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

 



- Lo-Fi Version Time is now: 28th March 2024 - 03:22 AM